goldstein,

I solved this day of in , 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

18+ goldstein,

some random examples of weird footguny semantics in Raku:

my @arr = (2, 3);<br></br>reduce &[+], 1, @arr;<br></br>

is 3 (list gets reinterpreted as a scalar). you need to use |@arr for it to work.

reduce &[(&)], ();<br></br>

(identity element for set intersection) is an empty set for some reason.

Set.new((1, 2), (3, 4)) (&) Set.new((3, 4), (5, 6))<br></br>

is an empty set (sets use comparison by identity, so all the lists are considered different).

set((1, 2), (3, 4))<br></br>

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.

18+ samebchase,
@samebchase@fantastic.earth avatar

@goldstein Hmm, even in the official documentation it seems to require the | (slip) operator. https://docs.raku.org/routine/reduce

Could any experienced Rakoon let us know why this is necessary?

#rakulang

  • All
  • Subscribed
  • Moderated
  • Favorites
  • raku
  • DreamBathrooms
  • mdbf
  • ethstaker
  • magazineikmin
  • GTA5RPClips
  • rosin
  • thenastyranch
  • Youngstown
  • InstantRegret
  • slotface
  • osvaldo12
  • kavyap
  • khanakhh
  • Durango
  • megavids
  • everett
  • cisconetworking
  • normalnudes
  • tester
  • ngwrru68w68
  • cubers
  • modclub
  • tacticalgear
  • provamag3
  • Leos
  • anitta
  • JUstTest
  • lostlight
  • All magazines