This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
02:34 razetime joined 03:07 jgaz joined 03:15 jgaz left 03:17 deoac joined 03:46 Kaiepi left 04:29 deoac left 05:24 Heptite left 09:08 razetime left 09:09 Kaiepi joined 14:09 jgaz joined 14:35 jgaz left 14:41 Heptite joined
yabobay is there a comb for arrays 15:02
Nemokosch rotor? 15:13
what would "comb for arrays" actually do? 15:14
yabobay exactly what rotor does
thank u 15:15
15:50 Kaiepi left 16:18 Kaiepi joined
how do i make a sub that can be called *by* a object? 18:27
something that can be called by all ints for example
Nemokosch what does that mean?
yabobay m: 18:28
sub p1 ($x) { $x + 1 }
say 3.p1;
Nemokosch oh there is a syntax for that 18:30
m: sub p1($x) { $x + 1 }; say 3.&p1;
yabobay oh ok, thank you
Nemokosch the .& methodoperator
it works with vanilla blocks as well 18:31
m: 3.&{ $^x + 1 }.say
yabobay what does ^x mean? u never declared that 18:33
Nemokosch that's kind of the point haha
these $^variables turn into positionals parameters in the signature, in alphabetic order 18:34
these $^variables turn into positional parameters in the signature, in alphabetic order
m: (1, 2, 3, 87).map({ $^b - $^a }).say 18:35
m: (1, 2, 3, 87).map({ $^a - $^b }).say
does it make sense?
yabobay ohh yeah i see 18:36
if i give a array as an argument to append, it will add each element of the list individually. how do i make it add the whole list as i gave it ? 18:46
Nemokosch the idiomatic solution is to just use push 18:50
it's kind of a feature of append that it adds the elements individually, if that's not what you want, there is push 18:51
yabobay thank you
Nemokosch docs.raku.org/language/functions#S...onventions this can help about the general tendencies 18:53