This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-27
Channels
- # announcements (8)
- # babashka (11)
- # beginners (34)
- # clerk (11)
- # clj-http (2)
- # clojure (5)
- # clojure-europe (9)
- # clojure-gamedev (1)
- # clojure-nl (1)
- # clojure-norway (17)
- # clojure-poland (1)
- # clojure-sweden (5)
- # clojure-uk (9)
- # clojurescript (17)
- # core-typed (12)
- # cursive (4)
- # datahike (4)
- # datalevin (2)
- # datomic (7)
- # emacs (8)
- # events (8)
- # graphql (5)
- # gratitude (1)
- # hyperfiddle (19)
- # jobs-discuss (4)
- # leiningen (4)
- # lsp (21)
- # meander (2)
- # off-topic (9)
- # play-clj (1)
- # polylith (10)
- # releases (1)
- # sci (18)
- # vim (10)
How would you solve a situation in meander where you have to use regex do the following steps? 1. Find multiple keywords in a map based on regex? (pattern X_from_Y) 2. Iterate the submap values and collect their keys and name from their values. 3. Output the results
{:random-values []
:blue_from_red {:red1 {:name "red-sample-1}
:red2 {:name "red-sample-2}}
:blue_from_black {:black1 {:name "black-sample-1"}}
:some {:other {:name "do-not-mix-this-into-data"}}
:more-random-values []}
I'm trying to write a pattern that read the name values under from keys in the above data without reading the other names structure regardless of colours used.In this case the solution i've created is a dirty one, but in short. I resolve the keys outside of meander functions and then apply the rewrites to the values in a loop.
It is definately a dirty code and a solution I wouldn't recommend but with my lack of understanding of meander it was the first working solution to the problem.
Proper solution probably uses seqable
to find the keys and store the values into a !
type variable if the key matches a pattern. Maybe by using the or
statement that captures it's input from the docs or something. But I couldn't get that to work as i ran out of time.
if I figure out a proper solution later when work permits on i'll update it here.