|
00:00
discord-raku-bot left,
colemanx left,
discord-raku-bot joined
00:03
getimiskon left
00:05
getimiskon joined
00:51
parv joined,
parv left,
parv joined
01:00
colemanx joined
|
|||
| colemanx | How do I use run to spawn a subprocess in a particular working directory? | 01:06 | |
| ah i did it :) my $p = run 'ls', cwd => '/tmp'; | 01:11 | ||
|
01:16
getimiskon left
08:47
dakkar joined
14:32
A26F64 joined
15:14
riffraff joined
|
|||
| riffraff | hey everyone, forgive me for the dumb question, but I've just started to play with RakuĀ :) . | 15:37 | |
| I was wondering, is there a way to apply an infix operator to all pairs in a list of pairs, other than explicitly using .map ? | |||
| I have this | |||
| (1,2,3,4).rotor(2 => 0).map: {$_[0] +$_[1]} | |||
| I can avoid unpacking $_ with reduce, | |||
| ...map: {[+] $_} | |||
| but I think there should be a way to compress the block with something like | |||
| ....map: infix:<+> | |||
| but I can't find the appropriate incantation :) | |||
| I also thought I could use | |||
| ....map: * + * | |||
| but the pair is not "unpacked" and so this doesn't work :/ | |||
| lizmat | m: dd (1,2,3,4).rotor(2 => 0).map: {$_[0] +$_[1]} | 15:41 | |
| camelia | (3, 7).Seq | ||
| lizmat | m: dd (1,2,3,4).rotor(2).map: {$_[0] +$_[1]} | ||
| camelia | (3, 7).Seq | ||
| lizmat | m: dd (1,2,3,4).rotor(2)>>.sum | ||
| camelia | (3, 7) | ||
| lizmat | riffraff ^^ | ||
| riffraff | right, but that works because of the list.sum method, it wouldn't work with > or % for example (I think?) | 15:43 | |
| lizmat | ah, indeed | ||
|
15:44
A26F64 left
|
|||
| lizmat | m: dd (1,2,3,4).rotor(2)>>.&infix:<%> | 15:44 | |
| camelia | ($(1, 2), $(3, 4)) | ||
| lizmat | m: dd (1,2,3,4).rotor(2)>>.Slip>>.&infix:<%> | 15:45 | |
| camelia | (1, 2, 3, 4) | ||
| lizmat | mmeh | ||
| m: sub doit(@a) { [%] @a }; dd (1,2,3,4).rotor(2)>>.&doit | 15:46 | ||
| camelia | Type check failed in binding to parameter '@a'; expected Positional but got Int (1) in sub doit at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
| lizmat | meh | ||
| Morfent | m:``` | 16:58 | |
| say &infix:<+>.signature; | |||
| say &infix:<%>.signature; | |||
| ``` | |||
| m:``` | 16:59 | ||
| say (1,2,3,4).map(&infix:<%>) | |||
| ``` | |||
|
17:00
riffraff left
|
|||
| oh pairs | 17:04 | ||
|
17:41
dakkar left
|
|||
| qorg11 | Equivalent to write something like while((c = read(fd, buf, 256)) > 0 ) in raku? | 17:42 | |
| I did while $c > 0 { | |||
| $c = cread(...); | |||
| } | |||
| lizmat | "file".IO.open(:bin).read(256) | 17:45 | |
| ? | |||
| my $h = "1".IO.open(:bin); while $h.read(256) -> $buf { say $buf.elems } | 17:47 | ||
| ? | |||
| qorg11 | Well i didn't mean reading a file but setting a variable inside the while loop and evaluating it | 17:48 | |
| Like you can do while((readline("> ")) != NULL) | 17:49 | ||
| lizmat | my $c = 42; while $c { ... } | 17:52 | |
| ?? | |||
| my $c = 42; while $c != 666 { ... } | |||
| qorg11 | Can't i just use the return value from a function as the condition? | 18:29 | |
| And assign the return value (inside the condition) as the thing to evaluate? | |||
| Yeah just figured it out | 18:32 | ||
| ls.qorg11.net/files/QEeuRmhn/-.txt | |||
| ls.qorg11.net/files/piPpWJlR/-.txt that especifially | 18:33 | ||
| lizmat | True < 10 ? | 19:00 | |
| guess that's true | |||
| Nemokosch | what is this good for? | 19:04 | |
| SmokeMachine | m: dd (1,2,3,4).rotor(2).map: -> ($a, $b) { $a + $b } | 19:44 | |
| camelia | (3, 7).Seq | ||