This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-05
Channels
- # announcements (8)
- # babashka (6)
- # beginners (55)
- # biff (8)
- # calva (11)
- # cider (4)
- # clj-kondo (6)
- # cljdoc (23)
- # cljs-dev (22)
- # clojure (89)
- # clojure-brasil (3)
- # clojure-europe (47)
- # clojure-indonesia (1)
- # clojure-nl (1)
- # clojure-spec (3)
- # clojure-uk (5)
- # clojurescript (67)
- # community-development (2)
- # conjure (29)
- # cursive (2)
- # datalog (29)
- # datomic (41)
- # defnpodcast (4)
- # emacs (15)
- # google-cloud (5)
- # holy-lambda (6)
- # hyperfiddle (3)
- # introduce-yourself (8)
- # jobs (1)
- # malli (19)
- # meander (41)
- # nrepl (1)
- # off-topic (30)
- # pathom (22)
- # polylith (30)
- # releases (1)
- # remote-jobs (4)
- # sci (4)
- # shadow-cljs (1)
- # spacemacs (7)
- # specter (3)
- # tools-build (16)
- # tools-deps (2)
Is meander the worlds most powerful lens? 😄 https://www.hytradboi.com/2022/cambria-schema-translations-in-distributed-systems-using-bidirectional-lenses
this sounds to me a lot like the work I do on Pathom, which covers the case for schema evolution, you can always make resolvers to allow both old and new names to work together 🙂 have you checked #pathom @U0P7M2VHR?
just for fun, I re-created the Cambria todo demo using Pathom 3: https://gist.github.com/wilkerlucio/ca2628616ea8bf42e24169f02b9c30a5
specter is the clojure lens library, and indeed for me confirm pathom + meander crowds out its uses 95% of the time
This video is quite a bit different though. Bi-directional, middleware on top of an event log.
Just the yaml would be so much nicer to replace with meander expression that works both directions.
* specter is the clojure lens library, and indeed for me pathom + meander crowds out its uses 95% of the time
Is there something like [_ ... true _ . (m/pred string? !s) ..1 (m/or false $)]
where $
is like regex end-of-line (end of seq/vector) in meander?
I couldn’t find it 🤷
Some where there is a true
followed by another object followed by 1 or more strings end the end of the sequence is either [false]
or []
(because we consumed everything)
(def input [1 2 true 3 "foo" "bar" 4 5 "not after thing" 6 true 34 "more" "text" "thing" 4 5])
(m/search input [& _ true _ & [(m/pred string? !s) ..1] & (m/or [(m/pred (complement string?))] [])] !s)
=> ()
(m/search input [& _ true _ & [(m/pred string? !s) ..1] & (m/or [(m/pred (complement string?)) & _] [])] !s)
=>
(["foo" "bar"] ["more" "text" "thing"])
Is there any “efficiency” difference between the tail sequence matching, or “inline” matching?
(m/search input [_ ... true _ . (m/pred string? !s) ..1 & (m/or [(m/pred (complement string?)) . _ ...] [])] !s)
also works, but I need &
for the m/or
to work@U06MDAPTP do you expect any performance difference? Or is the rewrite going to change everything? 😄
Well, the goal is to eventually exceed the current level of performance in many situations, however, at the moment I've only been focused on building out the most basic implementation of the semantics. The basic implementation is an interpreter and I'm very close to having it finished. Once that is done, work will start on optimizing that by using simplification (aka rewriting rules). After that, the then moving on to a compiler, probably doing something staged, would be next.

The zeta-0
branch does staged compilation and produces very nice code in many situations. The problem was that the compiler was too slow to be suitable for a macro. Also, in some cases debugging was a bit difficult. I could have a suite a of passing tests that showed that all the basic parts were working correctly but I would encounter unexpected interaction behavior between those parts.
Well this is good to know!
user=> (m/search (vec "ayo nopromptz") [!first & _ !last] [!first !last])
([[\a] [\z]])
I don’t really get it yet though:
(m/search (vec "ayo nopromptz") [?first & [_ ..1 ?last] ?last2] [?first ?last ?last2])
([\a \t \z])
So the first vector directly after & can match, and then more can follow outside the vector that basically terminates the in-vector match earlier 🤯 (because ?last
becomes \t
and not \z
)
This even more confusing
user=> (m/search (vec "ayo nopromptz") [?first & [_ ..1 \y \o \space \n \o \p \r \o \m \p ?last] ?last2] [?first ?last ?last2])
([\a \t \z])
but
user=> (m/search (vec "ayo nopromptz") [?first & [_ ... \a \y \o \space \n \o \p \r \o \m \p ?last] ?last2] [?first ?last ?last2])
nil
a
is captured in ?first
but then _ ..1
still matches!
But when a
is captured in ?first
it’s not available in & [_ ... \a \y \o
Seems like a bug
(m/search (vec "ayo nopromptz") [?first & [_ ..1337 \y \o \space \n \o \p \r \o \m \p ?last] ?last2] [?first ?last ?last2])
([\a \t \z])
This works pretty much like expected
user=> (m/search (vec "ayo nopromptz") [?first & [_ \y \o \space \n \o \p \r \o \m \p ?last] ?last2] [?first ?last ?last2])
nil
user=> (m/search (vec "ayo nopromptz") [?first & [\y \o \space \n \o \p \r \o \m \p ?last] ?last2] [?first ?last ?last2])
([\a \t \z])
Can I have more than 1 group after & :thinking_face: Yes!
(m/search
(vec "ayo nopromptz")
[?first
& [\y \o \space]
& [\n \o \p \r \o \m \p ?last]
?last2]
[?first ?last ?last2])
=>
([\a \t \z])