Fork me on GitHub
#events
<
2022-09-02
>
bruno.bonacci10:09:55

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.

bruno.bonacci10:09:22

The London Clojurians are happy to present: Graphcom: composable incremental graph of computations (by Alberto Fernandez) https://www.meetup.com/london-clojurians/events/288224718/

bruno.bonacci10:09:30

The London Clojurians are happy to present: Transform anything with Pattern (by Darrick Wiebe) https://www.meetup.com/London-Clojurians/events/288224789/

Darrick Wiebe16:09:32

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!

licht1stein20:11:54

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.

Darrick Wiebe20:11:55

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.

licht1stein20:11:30

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.

Darrick Wiebe20:11:58

No need to apologize, I just wanted to be clear since I don't really know what Meander can/can't do.

Darrick Wiebe20:11:42

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.

Darrick Wiebe20:11:29

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.

Darrick Wiebe20:11:40

Those compose arbitrarily in either order.

licht1stein20:11:14

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.

Darrick Wiebe20:11:16

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.

Darrick Wiebe20:11:04

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...

Darrick Wiebe20:11:29

A rule or rule-list, etc are functions that you can call with an instance of your data.

Darrick Wiebe20:11:04

so (def r (rule ...)) then (for [record json-data] (r record))

Darrick Wiebe20:11:29

I recommend playing with it in the repl

bruno.bonacci10:09:52

The London Clojurians are happy to present: Reveal: lessons learned (by Vlad Protsenko) https://www.meetup.com/London-Clojurians/events/288224866/

bruno.bonacci10:09:08

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/)

🎉 1