Post AcnPC79JDh8H8xIFcm by goldstein@im-in.space
(DIR) More posts by goldstein@im-in.space
(DIR) Post #AcnPC6M2AtiWg8Etou by goldstein@im-in.space
2023-12-13T19:18:22Z
0 likes, 0 repeats
I solved this day of #AdventOfCode in #Rakulang, which still looks fun, until I try to actually write it and discover once again that basically every operation has some weird footguny semantics. nevertheless, I’m quite happy with the final result, which looks nice and concise.https://github.com/GoldsteinE/aoc2023/blob/master/day13/code/main.raku
(DIR) Post #AcnPC79JDh8H8xIFcm by goldstein@im-in.space
2023-12-13T21:02:11Z
1 likes, 0 repeats
some random examples of weird footguny semantics in Raku:my @arr = (2, 3);reduce &[+], 1, @arr;is 3 (list gets reinterpreted as a scalar). you need to use |@arr for it to work. reduce &[(&)], ();(identity element for set intersection) is an empty set for some reason. Set.new((1, 2), (3, 4)) (&) Set.new((3, 4), (5, 6))is an empty set (sets use comparison by identity, so all the lists are considered different).set((1, 2), (3, 4))is a set of four numbers 1, 2, 3, 4, set flattens its arguments, while Set.new does not. sequences like x...^y and (x..^y).reverse are either not actually lazy, or just really slow, not sure which one.
(DIR) Post #AcnPC7z47GX5jTVaIS by samebchase@fantastic.earth
2023-12-14T05:13:40Z
1 likes, 0 repeats
@goldstein Hmm, even in the official documentation it seems to require the `|` (slip) operator. https://docs.raku.org/routine/reduceCould any experienced Rakoon let us know why this is necessary?#rakulang