This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-14
Channels
- # asami (1)
- # babashka (50)
- # beginners (70)
- # bristol-clojurians (6)
- # calva (36)
- # chlorine-clover (1)
- # cider (4)
- # clj-kondo (3)
- # cljdoc (49)
- # cljsrn (5)
- # clojure (96)
- # clojure-australia (3)
- # clojure-dev (1)
- # clojure-europe (84)
- # clojure-nl (4)
- # clojure-spec (9)
- # clojure-uk (65)
- # clojurescript (31)
- # community-development (6)
- # conjure (17)
- # cursive (8)
- # datascript (5)
- # datomic (12)
- # duct (3)
- # emacs (18)
- # figwheel-main (2)
- # fulcro (7)
- # helix (1)
- # jobs (3)
- # luminus (7)
- # off-topic (77)
- # pathom (3)
- # portal (1)
- # rdf (4)
- # re-frame (1)
- # reitit (4)
- # remote-jobs (4)
- # reveal (15)
- # rum (1)
- # sci (38)
- # shadow-cljs (22)
- # spacemacs (1)
- # specter (6)
- # sql (1)
- # test-check (1)
- # tools-deps (60)
- # vim (12)
question regarding preference: do you add your specs to an existing namespace of a domain model or do you have a separate spec namespace to share your specs around?
@johnjelinek Here's how we organize the different types of specs we write https://corfield.org/blog/2019/09/13/using-spec/
so, how safe is it to use s/conform
as a regex matcher?
As in https://juxt.pro/blog/parsing-with-clojure-spec
(s/def ::contentline
(s/cat
:name ::iana-token
:params (s/*
(s/cat
:semi #{\;}
:param-name ::iana-token
:equals #{\=}
:param-value ::iana-token))
:colon #{\:}
:value ::iana-token))
(s/conform
::contentline
(seq "DTSTART;TZID=US-EAST:20180116T140000"))
=>
{:name [\D \T \S \T \A \R \T],
:params
[{:semi \;,
:param-name [\T \Z \I \D],
:equals \=,
:param-value [\U \S \- \E \A \S \T]}],
:colon \:,
:value [\2 \0 \1 \8 \0 \1 \1 \6 \T \1 \4 \0 \0 \0 \0]}
(apply str (get-in ā¦ [:params 0 :param-value]))
=> "US-EAST"
spec isn't designed for string parsing -- I've seen people recommend instaparse: (alex miller on the topic) https://www.reddit.com/r/Clojure/comments/fx5ko1/parser_libraries/fmttmzy/?utm_source=amp&utm_medium=
Thanks @U09QBCNBY!
I think Iām not that interested in performance here, more interested in how stable the implementation will be.
Thinking about using it to parse recurrence rule from RFC5545 https://icalendar.org/iCalendar-RFC-5545/3-3-10-recurrence-rule.html
ack, thanks!