This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-02
Channels
- # adventofcode (6)
- # announcements (6)
- # babashka (21)
- # babashka-sci-dev (18)
- # biff (6)
- # clara (4)
- # clj-commons (2)
- # clj-kondo (7)
- # cljdoc (4)
- # clojure (9)
- # clojure-berlin (8)
- # clojure-europe (23)
- # clojure-gamedev (3)
- # clojure-indonesia (1)
- # clojure-nl (1)
- # clojure-norway (10)
- # clojure-poland (1)
- # clojurescript (27)
- # community-development (1)
- # conjure (32)
- # etaoin (6)
- # events (20)
- # fulcro (5)
- # graalvm (1)
- # helix (19)
- # hyperfiddle (14)
- # introduce-yourself (2)
- # music (1)
- # nbb (24)
- # off-topic (37)
- # pathom (2)
- # polylith (14)
- # reagent (11)
- # releases (1)
- # remote-jobs (1)
- # reveal (22)
- # shadow-cljs (16)
- # sql (3)
- # squint (11)
- # test-check (2)
- # xtdb (36)
NEW DATE Hi all, Unfortunately we had to postpone this talk to November as Peter (the speaker) has work commitments which clash with the presentation.
The London Clojurians are happy to present: Graphcom: composable incremental graph of computations (by Alberto Fernandez) https://www.meetup.com/london-clojurians/events/288224718/
The London Clojurians are happy to present: Transform anything with Pattern (by Darrick Wiebe) https://www.meetup.com/London-Clojurians/events/288224789/
I'm looking forward to presenting! If anyone happens to look at https://github.com/pangloss/pattern in advance and has any kind of question, please ask me. Happy to answer!
It's purpose is similar to meander, right? I'm struggling with meander a little right now and would be eager to try something alternative.
I didn't build pattern in relation to or in response to Meander. What I can say is that pattern can do a lot of different data transformations very effectively using understandable clear code.
I wasn't implying you have, sorry. It's just for me it's hard to understand if I can take a complex nested map and transform it into a flat map with pattern. If I can I'd like to learn to do it.
No need to apologize, I just wanted to be clear since I don't really know what Meander can/can't do.
You can create a pattern to match the map keys you're interested in with (?:map :key val :key2 val2)
In this matcher, the key needs to be the literal key you're matching, but val can be a specific value to match, a ?var
to capture, or a nested pattern like another (?:map ...)
, etc.
If you need to match multiple kv pairs from a map, you can use (?:*map key val)
, but in this case, both key and val need to be either a ?var
or another pattern in order to match anything.
Those compose arbitrarily in either order.
I have about 50 thousand roughly similar json files, I want to bring them all to the same flat format. Some of them are missing some parts, others are missing other parts. That's the task I'm trying to solve.
If you want to create something from what you match, use (rule pattern rule-body)
, where rule body has all of your matchers already bound to local vars by names.
You can create multiple rules for your different variants. If a rule doesn't match it makes no changes. Then you can just chain them with (rule-list (rule ...) (rule ...))
, or other rule combinators...
A rule or rule-list, etc are functions that you can call with an instance of your data.
so (def r (rule ...))
then (for [record json-data] (r record))
I recommend playing with it in the repl
The London Clojurians are happy to present: Reveal: lessons learned (by Vlad Protsenko) https://www.meetup.com/London-Clojurians/events/288224866/
Hi All here all upcoming London Clojurians online events: - 2022-09-06 - *Transform MSOffice into Data Microservices With Clojure on .NET (by Bob Calco)* - (https://www.meetup.com/london-clojurians/events/286468872/) - 2022-10-18 - *Graphcom: composable incremental graph of computations (by Alberto Fernandez)* - (https://www.meetup.com/london-clojurians/events/288224718/) - 2022-11-01 - *Transform anything with Pattern (by Darrick Wiebe)* - (https://www.meetup.com/london-clojurians/events/288224789/) - 2022-11-15 - *Reveal: lessons learned (by Vlad Protsenko)* - (https://www.meetup.com/london-clojurians/events/288224866/) - 2022-11-29 - *Joyride VS Code using a Clojure REPL (by Peter Strömberg and Michiel Borkent)* - (https://www.meetup.com/london-clojurians/events/286030325/)