»ö« #raku and #raku-dev are OPEN FOR BUSINESS | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by mst on 15 October 2019.
Hermit [{a=>1}, {b=>2}, {c=>3}].reduce({ $^a{$^b.keys} = $^b.values }) 05:44
should work? 05:45
anyone home? 05:49
another version, better error message: 05:50
({a=>1}, {b=>2}, {c=>3}).reduce( sub (Hash $a, Hash $b) { $a{$b.keys} = $b.values })
so basically, if you try to .reduce an Array of Hashes, it won't bind the individual Hashes to Hashes -- it tries to bind something to List 05:51
never mind, figured it out 05:53
reduce is a weird operator
Juerd What are you trying to accomplish? 11:23
Oh, they left hours ago :) 11:24
timotimo i'm pretty sure the surprise came from $b.values being returned from the first invocation and being passed as $a the next time 11:25
rindolf Juerd: timotimo : hi, sup? 12:43
Juerd Soup?
rindolf Juerd: soup nazi!
Juerd Er, what? 12:44
rindolf Juerd: no soup for you
Juerd: en.wikipedia.org/wiki/The_Soup_Nazi
Juerd: seriously now: how are you? 12:45
Juerd: sup is en.wiktionary.org/wiki/sup#Interjection 12:46
Juerd I don't discuss personal matters in publicly logged channels
rindolf Juerd: ah, ok
Juerd Have done so before, didn't like it a decade later.
rindolf Juerd: you can pm me or /join #perlcafe 12:47
Juerd: i've been working on a captioned image
SmokeMachine m: say [{:1a}, {:2b}, {:3c}].reduce: { { |$^a, |$^b } } 13:03
evalable6 (exit code 1) Too many positionals passed; expected 0 or 1 arguments but got 2
in block <unit> at /tmp/btKQHJAR5M line 1
SmokeMachine m: say [{:1a}, {:2b}, {:3c}].reduce: { %( |$^a, |$^b ) } 13:04
evalable6 {a => 1, b => 2, c => 3}