Fork me on GitHub
#clojure-europe
<
2023-01-27
>
jackrusher08:01:57

moin moin

❤️ 2
otfrom09:01:47

that wiki is really the only reason I know about moin

javahippie08:01:55

As a German, I feel that this account often is not very accurate. But Moin! 😁

otfrom08:01:51

I did wonder if it would provoke a correction

javahippie08:01:24

German-ness confirmed 😅

otfrom08:01:26

my only time speaking German to native speakers was in Scotland and they all teased me for saying Ich rather than Ish

javahippie08:01:50

I don‘t think anybody should be teased for speaking a foreign language. And „Ich“ vs „ish“ is a local thing, too, so you just had a different dialect 😉

simongray09:01:10

it's not just a Northern German thing, it's also heavily used in Southern Denmark

simongray09:01:14

same meaning

simongray09:01:35

it's one of those regional, cross-language words

javahippie09:01:18

I think the cultural and geographical borders between Denmark and Germany are not that sharp. In the Schleswig Holstein Region in Germany there is even a party in the regional parliament which represents the ethnically danish people

simongray09:01:29

yeah, we also have a small German-speaking minority in Southern Denmark. I actually think they're quite defined compared to how it was historically (pre-1920) since the northern parts of Germany used to be primarily German-speaking territory of Denmark prior to the conquests of Prussia.

simongray09:01:21

the 1920 vote is IMO quite unique and effective in how it resolved that border dispute, even if Denmark was ultimately made smaller

javahippie10:01:33

And it’s also rare that there are cultural minorities on both sides of the border and nobody seriously thinks or campaigns that they have claims on that land, seems really civil. Well, aside from that hog fence

lemontea17:01:10

so… moin would be a perfect word for UGT in this channel?

2
slipset07:01:10

Good mornin

grav08:01:57

Morning 🙂

Jakub Holý (HolyJak)08:01:47

Morning! Today I am dealing with a huge tree of data and need to find paths to all nodes that satisfy a predicate. Any tips? 🙏

kolstae08:01:06

Morning! You could use https://github.com/aysylu/loom perhaps? nodes-filtered-by and some pathfinding

Jakub Holý (HolyJak)08:01:20

I did not know about that, will have a look. Though I’d prefer adding a library.

simongray08:01:14

or clojure.walk

simongray08:01:24

probably the easiest solution is walk

jackrusher08:01:33

impossible to give good advice without knowing the data structure you have now

Jakub Holý (HolyJak)08:01:38

walk gives you the form but not location

simongray08:01:44

then zippers

Jakub Holý (HolyJak)08:01:16

Well, maps and vectors nested in each other 🙂 Thx, have never really used zippers, will have a look

simongray08:01:39

you can loop through a zipper, pause and navigate the tree from any point to have a look around, before you keep looping. The trade-off is that you need to build a little bit of imperative code to make the machine work.

jackrusher08:01:58

@U0522TWDA Ah, okay. In many tree contexts, you've got a parent pointer from each node that you can trivially run up to the root. If you have a downward-only tree, you'll have to follow paths down from the root. Will there be nodes that satisfy the predicate beneath other nodes that satisfy the predicate? And, if so, what do you want to happen there?

borkdude09:01:57

jq has a paths function which I may or may not want to include in jet: https://github.com/borkdude/jet/issues/124

thomas09:01:12

Or use something like jGraphT. O used it a bit from Java and it's pretty good.

Jakub Holý (HolyJak)09:01:20

The predicate in this case only applies to leaf nodes Thank you all!

borkdude10:01:29

@U0522TWDA I'm now working on jet and I want to include this function in jet, like the jq one. Good timing.

🎉 2
borkdude10:01:14

I've written this function once in 2013 in a project

borkdude10:01:56

$ echo '{:a {:b [1 2 3 {:x 2}] :c {:d 3}}}' | clojure -M -m jet.main -t 'jet/paths'
[[:a]
 [:a :b]
 [:a :c]
 [:a :b 0]
 [:a :b 1]
 [:a :b 2]
 [:a :b 3]
 [:a :b 3 :x]
 [:a :c :d]]

borkdude11:01:55

I'm thinking about something like this: return maps so you can do more stuff with the results

$ echo '{:a {:b [1 2 3 {:x 2}] :c {:d 3}}}' | clojure -M -m jet.main -t '(jet/paths {:pred odd?})'
({:path [:a :b 0], :val 1}
 {:path [:a :b 2], :val 3}
 {:path [:a :c :d], :val 3})

borkdude11:01:24

Or maybe just:

$ echo '{:a {:b [1 2 3 {:x 2}] :c {:d 3}}}' | clojure -M -m jet.main -t '(jet/paths) (filter #(and (number? (:val %)) (odd? (:val %))))'
({:path [:a :b 0], :val 1}
 {:path [:a :b 2], :val 3}
 {:path [:a :c :d], :val 3})
and not even the :pred option

borkdude12:01:12

@U0522TWDA I've now published a new #CM5HRADAA version with the jet/paths function

Jakub Holý (HolyJak)13:01:43

Thank you! I'll give it a try when I'm online

simongray08:01:49

good morning

borkdude09:01:40

good morning

schmalz09:01:43

Morning all - nearly the weekend!