meander

eoliphant 2021-08-12T18:08:41.027600Z

hi i’m trying to do a transform where i need to select a single value out of a list.. something like

{:a "a" 
 :b  [{:name "pickme" :value "foo"} {:name "somethingelse" :value "bar" ..]}
;becomes
{:my/a "a"
 :my/b "foo"}

; have tried various things with ... scan, etc but i'm obivously not doing the right thing
{...
 :b [{:name "pickme" :value !value} ...]}

etc

2021-08-12T18:27:58.028300Z

(m/rewrite {:a "a"
            :b [{:name "pickname" :value "foo"} {:name "somthingelse" :value "bar"}]}
  {:a ?a
   :b [{:value !value} ...]}
  [{:my/a ?a
    :my/b !value} ...])
;; => [#:my{:a "a", :b "foo"} #:my{:a "a", :b "bar"}]

2021-08-12T18:30:04.028500Z

Wait, I misread

2021-08-12T18:30:43.028700Z

You want to get whatever has pickme

eoliphant 2021-08-12T18:30:48.028900Z

right.

eoliphant 2021-08-12T18:30:55.029100Z

i got something sorta working with cata

2021-08-12T18:31:36.029300Z

(m/rewrite {:a "a"
            :b [{:name "pickme" :value "foo"} {:name "somthingelse" :value "bar"}]}
  {:a ?a
   :b (m/scan {:name "pickme" :value !value})}
  {:my/a ?a
   :my/b !value})

;; => #:my{:a "a", :b "foo"}

eoliphant 2021-08-12T18:32:04.029700Z

ok cool i thought i tried that but at this point who knows lol

eoliphant 2021-08-12T18:32:07.029900Z

one sec

eoliphant 2021-08-12T18:33:56.030100Z

ah i was using match instead of rewrite

eoliphant 2021-08-12T18:33:57.030300Z

ugh

eoliphant 2021-08-12T18:33:59.030500Z

thx!

2021-08-12T18:35:58.030700Z

Scan does not work with match, but with find it does.

2021-08-12T18:36:05.030900Z

(m/find {:a "a"
            :b [{:name "pickme" :value "foo"} {:name "somthingelse" :value "bar"}]}
  {:a ?a
   :b (m/scan {:name "pickme" :value !value})}
  {:my/a ?a
   :my/b !value})

eoliphant 2021-08-12T18:36:32.031100Z

gotcha. still working through what works with what lol

2021-08-12T18:37:09.031300Z

and if you don't need to collect multiple values, it's a better idea to use ?value instead of !value

2021-08-12T18:40:05.031500Z

The learning curve of meander is very steep, I recommend to start with find, only after that play with rewrite, and finally recursion with cata and with

πŸ‘ 1
eoliphant 2021-08-12T18:43:43.031900Z

yeah that’s what threw me a little

eoliphant 2021-08-12T18:44:17.032100Z

because i know i wanted a single value ?… but in that context most of the examples are the memory vars !..

eoliphant 2021-08-12T18:44:26.032300Z

gotca

eoliphant 2021-08-12T18:44:36.032500Z

will use that heuristic going forward

2021-08-12T18:45:42.032900Z

memory vars will always work too, but they are obviously slower

eoliphant 2021-08-12T18:46:43.033100Z

i’ll maybe add that to the docs lol. because it seems simple for a lot of common cases but, yeah there are quite a few dangerous left turns lol

noprompt 2021-08-12T22:38:11.037500Z

@eoliphant I merge 100% of patches to our docs. πŸ™‚

πŸ‘πŸΌ 1
noprompt 2021-08-12T19:56:18.034200Z

Has anyone had a chance to double check if whats on epsilon right now works for them e.g. it passes tests, etc.?

2021-08-12T20:00:44.034600Z

1 sec

2021-08-12T20:02:55.034700Z

2021-08-12T20:04:26.035Z

2021-08-12T20:05:18.035400Z

doxa uses meander very heavily and it also seems to work.

noprompt 2021-08-12T20:11:34.036300Z

Awesome. What font is that? I looks almost like Monoid.

2021-08-12T20:45:49.036500Z

Iosevka

2021-08-12T20:46:36.036900Z

[buildPlans.iosevka-custom]
         family = "Iosevka Custom"
         spacing = "normal"
         serifs = "sans"
         no-cv-ss = true

         [buildPlans.iosevka-custom.variants]
         inherits = "ss04"

         [buildPlans.iosevka-custom.ligations]
         inherits = "dlig"

noprompt 2021-08-12T20:52:47.037200Z

Ah, nice. I knew it looked familiar. πŸ™‚

2021-08-12T20:59:51.037400Z

A good font is essential, I admire people from the previous era who had to look at jagged angular fonts on crt monitors.

noprompt 2021-08-12T22:40:18.038700Z

The past couple years have been generous for monospace typography. There are so many fantastic options available.

noprompt 2021-08-12T22:41:37.039300Z

Also, I will probably cut a release tomorrow.

noprompt 2021-08-12T22:41:50.039700Z

@huxley After that I think we can get back on track with the fast flag.

2021-08-12T22:44:53.040Z

great:+1: