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. |
|||
00:00
gfldex joined
00:27
gfldex left,
gfldex joined
03:04
frost joined
|
|||
deadmarshal | I want to do the equivalent of this Perl code in Raku. return all {$_ % 2 != 0} (split //, $n + reverse $n); | 04:36 | |
I don't know how to use the all function in raku: return ($n + $n.flip).split(''); | |||
CIAvash | `($n + $n.flip).comb.grep: * !%% 2` ? | 04:54 | |
deadmarshal | CIAvash: Doesn't that filters only odd ones? I want to return true if all of the elements are odd and false otherwise | 04:59 | |
CIAvash | oh | 05:00 | |
`.comb.map(* !%% 2).all.so` | 05:08 | ||
deadmarshal | CIAvash: Yes, thank you! | 05:11 | |
CIAvash | m: sub odd ($n) { $n !%% 2 }; (164 + 164.flip).comb.all.&odd.so; | 05:21 | |
camelia | ( no output ) | ||
CIAvash | m: sub odd ($n) { $n !%% 2 }; say (164 + 164.flip).comb.all.&odd.so; | ||
camelia | False | ||
CIAvash | m: my &odd = * !%% 2; (164 + 164.flip).comb.all.&odd.so; | 05:22 | |
camelia | ( no output ) | ||
CIAvash | m: my &odd = * !%% 2; say (164 + 164.flip).comb.all.&odd.so; | ||
camelia | True | ||
CIAvash | hmm | ||
m: say (164 + 164.flip).comb.all.&(* !%% 2).so; | 05:23 | ||
camelia | True | ||
CIAvash | m: dd (164 + 164.flip).comb.all.&(* %% 2); m: dd (164 + 164.flip).comb.all.&(* !%% 2); | 05:24 | |
camelia | all(Bool::True, Bool::True, Bool::False) Bool::True |
||
CIAvash | m: dd (164 + 164.flip).comb.all.&(sub { $^n !%% 2 }) | 06:02 | |
camelia | all(Bool::False, Bool::False, Bool::True) | ||
07:17
dakkar joined
11:12
frost left
12:05
frost joined
12:08
frost left
12:23
frost joined
12:49
frost left
|
|||
SmokeMachine | deadmarshal: twitter.com/smokemachine/status/15...VOjAu4PDgw | 12:52 | |
m: (1 .. 100).grep: { [&&] ($_ + .flip).comb.map: *.all !%% 2 } | 12:56 | ||
camelia | ( no output ) | ||
SmokeMachine | m: say (1 .. 100).grep: { [&&] ($_ + .flip).comb.map: *.all !%% 2 } | ||
camelia | (10 12 14 16 18 21 23 25 27 30 32 34 36 41 43 45 50 52 54 61 63 70 72 81 90) | ||
deadmarshal | SmokeMachine: nice | 13:08 | |
13:21
jgaz joined
13:32
jgaz left,
jgaz joined
13:37
Nemokosch joined
|
|||
Nemokosch | Hello | 13:38 | |
Can I make multis that have common arguments without repeating those common arguments? | |||
lizmat | multi subs? | 14:12 | |
Nemokosch | yes? | 14:14 | |
lizmat | well, I guess you could use &proto.add_dispatchee with a multi sub that you put together, e.g. with an EVAL | 14:16 | |
at compile time | |||
Nemokosch | Can RAST help with it? | 15:02 | |
lizmat | RakuAST you mean? yes | 15:09 | |
Nemokosch | For now, I'm gonna just hack around with environment variables :DD | 15:23 | |
15:49
Kaiepi left
16:07
dakkar left
17:18
discord-raku-bot joined
17:30
Nemokosch left
17:31
discord-raku-bot left
17:32
discord-raku-bot joined
17:39
Kaiepi joined
20:49
Kaiepi left
20:51
Kaiepi joined
20:54
saint- left
21:22
jgaz left
|