🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku Set by ChanServ on 14 October 2019. |
|||
00:01
tj9450 joined
|
|||
[Coke] | wonder if it has something to do with the way cross is defined | 00:08 | |
m: dd &cross | |||
camelia | Sub+{is-pure}+{Precedence} infix:<X> = proto sub infix:<X> (|) {*} | ||
[Coke] | (it's an alias to infix<X> | ||
m: dd cross(<1 2 3>, <4 5 6>); my @params=(<a b c>,<d e f>); dd cross(@params[0], @params[1]); | 00:09 | ||
camelia | ((IntStr.new(1, "1"), IntStr.new(4, "4")), (IntStr.new(1, "1"), IntStr.new(5, "5")), (IntStr.new(1, "1"), IntStr.new(6, "6")), (IntStr.new(2, "2"), IntStr.new(4, "4")), (IntStr.new(2, "2"), IntStr.new(5, "5")), (IntStr.new(2, "2"), IntStr.new(6, "6"))… | ||
[Coke] | m: say cross(<1 2 3>, <4 5 6>); my @params=(<a b c>,<d e f>); say cross(@params[0], @params[1]); | ||
camelia | ((1 4) (1 5) (1 6) (2 4) (2 5) (2 6) (3 4) (3 5) (3 6)) (((a b c) (d e f))) |
||
[Coke] | m: say cross(<1 2 3>, <4 5 6>); my @params=(<a b c>,<d e f>); say cross(@params[0].List, @params[1].List); | 00:10 | |
camelia | ((1 4) (1 5) (1 6) (2 4) (2 5) (2 6) (3 4) (3 5) (3 6)) ((a d) (a e) (a f) (b d) (b e) (b f) (c d) (c e) (c f)) |
||
[Coke] | m: my @params=(<a b c>,<d e f>); dd @params[0]; | ||
camelia | List @params = $("a", "b", "c") | ||
[Coke] | tagging lizmat, as I know she just found a case where dd was pretending to be a type it wasn't. :) | 00:11 | |
tj94 | After looking at the dd outputs, it seems like the list is being flattened when being passed in as @params = (<1 2 3>, <4 5 6>); | 00:21 | |
Any tricks to keep the list from being flattened ? | |||
my @params = (<1 2 3>, <4 5 6>);dd @params; | 00:24 | ||
evalable6 | Array @params = [(IntStr.new(1, "1"), IntStr.new(2, "2"), IntStr.new(3, "3")), (IntStr.new(4, "4"), IntStr.new(5, "5"), IntStr.new(6, "6"))] | ||
tj94 | output: | ||
Array @params = [(IntStr.new(1, "1"), IntStr.new(2, "2"), IntStr.new(3, "3")), (IntStr.new(4, "4"), IntStr.new(5, "5"), IntStr.new(6, "6"))] | |||
dd (<1 2 3>, <4 5 6>); | |||
evalable6 | ((IntStr.new(1, "1"), IntStr.new(2, "2"), IntStr.new(3, "3")), (IntStr.new(4, "4"), IntStr.new(5, "5"), IntStr.new(6, "6"))) | ||
tj94 | output: | 00:25 | |
((IntStr.new(1, "1"), IntStr.new(2, "2"), IntStr.new(3, "3")), (IntStr.new(4, "4"), IntStr.new(5, "5"), IntStr.new(6, "6"))) | |||
Thank you !! Looks like you solved it with: | 00:33 | ||
my @params = (<1 2 3>, <4 5 6>, <7 8 9>); | |||
cross(@params.List); | |||
00:34
BenGoldberg joined
00:37
lucasb left
00:39
xinming_ left,
tj9450 left
00:41
xinming_ joined
|
|||
tbrowder | another class question, please: give class A with attribute $!value, class B is A: is there any way to acess $!value from an instance of B? | 00:44 | |
*given... | |||
00:44
BenGoldberg left,
Ben_Goldberg joined,
Ben_Goldberg is now known as BenGoldberg
00:51
cooper left
00:58
BenGoldberg left,
Ben_Goldberg joined,
Ben_Goldberg is now known as BenGoldberg
01:08
BenGoldberg left
01:12
molaf left
01:15
|oLa| joined
01:18
tj94 left
01:20
|oLa| left
01:24
molaf joined
01:32
xinming_ left
01:33
xinming_ joined,
Sgeo_ joined
01:36
Sgeo left
01:38
Sgeo__ joined
01:41
Sgeo_ left
01:47
hythm joined
01:57
pecastro joined
02:04
Manifest0 left
02:06
Manifest0 joined,
bocaneri is now known as Sauvin
02:44
pecastro left
02:53
vrurg joined
03:03
MasterDuke left
03:08
xinming_ left
03:09
xinming_ joined
03:45
skids joined
04:00
BenGoldberg joined
04:06
frost-lab joined
04:34
BenGoldberg left,
hythm left
04:42
andreoss left
05:01
maettu joined
05:30
maettu left
05:36
Altai-man joined
05:46
RobRaku joined
05:50
xinming_ left,
xinming_ joined
05:54
jmerelo joined
05:59
xinming joined
06:03
xinming_ left
|
|||
jmerelo | m: my $rx = "(.*)a(.*)b(.*)" | 06:15 | |
camelia | ( no output ) | ||
jmerelo | m: my $rx = "(.*)a(.*)b(.*)"; say 'xaybz' ~~ rx/<$rx>/ | ||
camelia | 「xaybz」 | ||
jmerelo | m: my $rx = "(.*)a(.*)b(.*)"; say 'xaybz' ~~ rx/$rx/ | ||
camelia | Nil | ||
jmerelo | m: my $rx = "(.*)a(.*)b(.*)"; say 'xaybz' ~~ rx/\qq[$rx]/ | 06:18 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unrecognized backslash sequence: '\q' at <tmp>:1 ------> 3 = "(.*)a(.*)b(.*)"; say 'xaybz' ~~ rx/\7⏏5qq[$rx]/ |
||
jmerelo | m: my $rx = "(.*)a(.*)b(.*)"; say 'xaybz' ~~ rx/<\qq[$rx]>/ | ||
camelia | 5===SORRY!5=== Unrecognized regex metacharacter < (must be quoted to match literally) at <tmp>:1 ------> 3 = "(.*)a(.*)b(.*)"; say 'xaybz' ~~ rx/<7⏏5\qq[$rx]>/ Unrecognized regex metacharacter \ (must be quoted to match literally) … |
||
jmerelo | m: my $rx = "\qq[(.*)a(.*)b(.*)]"; say 'xaybz' ~~ rx/<$rx>/ | 06:19 | |
camelia | 「xaybz」 | ||
jmerelo | m: my $rx = "\qq[(.*)a(.*)b(.*)]"; say 'xaybz' ~~ rx/$rx/ | ||
camelia | Nil | ||
jmerelo | m: my str $str = "\qq[(.*)a(.*)b(.*)]"; say Regex.new( :$str ) | 06:24 | |
camelia | Cannot make a Regex object using .new in block <unit> at <tmp> line 1 |
||
jmerelo | m: my str $str = "\qq[(.*)a(.*)b(.*)]"; say Method.new( :source($str) ) | 06:25 | |
camelia | Cannot make a Method object using .new in block <unit> at <tmp> line 1 |
||
jmerelo | m: my $rx = "(.*)a(.*)b"; say 'xaybz' ~~ rx/<$rx>/ | 06:30 | |
camelia | 「xayb」 | ||
jmerelo | Hum | ||
m: my $rx = '(.*)a(.*)b(.*)'; say 'xaybz' ~~ rx/<$rx>/ | 06:31 | ||
camelia | 「xaybz」 | ||
jmerelo | m: my $rx = '(.*)a(.*)b\(.*\)'; say 'xaybz' ~~ rx/<$rx>/ | ||
camelia | Nil | ||
jmerelo | m: my $rx = '(.*)a(.*)b(.*)'; say 'xaybz' ~~ rx/<$rx>/ | 06:32 | |
camelia | 「xaybz」 | ||
jmerelo | m: my $rx = '(.*)a(.*)b(.*)'; say 'xaybz' ~~ rx/$rx/ | ||
camelia | Nil | ||
jmerelo | m: my $rx = '(.*)a(.*)b(.*)'; say $rx.Str | ||
camelia | (.*)a(.*)b(.*) | ||
jmerelo | m: my $rx = '(.*)a(.*)b(.*)'; say 'xaybz' ~~ rx/$<result>=<$rx>/; say $result | 06:33 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$result' is not declared at <tmp>:1 ------> 3say 'xaybz' ~~ rx/$<result>=<$rx>/; say 7⏏5$result |
||
jmerelo | m: my $rx = '(.*)a(.*)b(.*)'; say 'xaybz' ~~ rx/$<result>=<$rx>/; say $<result> | ||
camelia | 「xaybz」 result => 「xaybz」 0 => 「x」 1 => 「y」 2 => 「z」 「xaybz」 0 => 「x」 1 => 「y」 2 => 「z」 |
||
jmerelo | m: my $rx = '(.*)a(.*)b(.*)'; 'xaybz' ~~ rx/$<result>=<$rx>/; say $<result> | 06:34 | |
camelia | 「xaybz」 0 => 「x」 1 => 「y」 2 => 「z」 |
||
06:36
skids left
06:39
cpan-raku joined,
cpan-raku left,
cpan-raku joined
06:45
abraxxa joined
06:50
abraxxa left
06:51
abraxxa joined
06:53
wamba joined
06:54
maettu joined
07:06
pecastro joined
07:17
Sgeo__ left
07:25
BenGoldberg joined
07:33
dakkar joined
07:34
aborazmeh joined,
aborazmeh left,
aborazmeh joined
07:41
domidumont joined
07:59
BenGoldberg left
08:04
Kaiepi left
08:06
Kaiepi joined,
molaf left
08:07
Kaiepi left
08:08
Kaiepi joined
08:11
MasterDuke joined
08:14
Kaiepi left
08:16
Kaiepi joined
08:21
aborazmeh left
08:24
aborazmeh joined,
aborazmeh left,
aborazmeh joined
08:27
esh left
08:28
esh joined
08:29
pecastro left,
pecastro joined
|
|||
jmerelo | m: say :key( { value => 1, another-value => 2 } ) | 08:31 | |
camelia | Unexpected named argument 'key' passed in block <unit> at <tmp> line 1 |
||
jmerelo | m: my %associative = :key( { value => 1, another-value => 2 } ); say %associative | ||
camelia | {key => {another-value => 2, value => 1}} | ||
08:37
molaf joined
08:44
maettu left
09:21
sena_kun joined
09:23
Altai-man left
09:29
maettu joined
09:42
aborazmeh left
09:44
RobRaku left,
epony left
09:48
RobRaku joined
09:55
epony joined
10:05
plant_enjoyer joined
10:06
plant_enjoyer left
10:10
maettu left
10:41
k-man left
10:43
k-man joined
10:50
BenGoldberg joined
10:52
ufobat joined
10:55
wamba left
10:56
_jrjsmrtn joined
10:57
__jrjsmrtn__ left,
maettu joined
11:17
wamba joined
11:24
BenGoldberg left
|
|||
tbrowder | .ask jkramer can you please help or advise direction with File::Copy for allowing copy file to dir | 11:46 | |
tellable6 | tbrowder, I'll pass your message to jkramer | ||
11:50
maettu left
11:56
tardisx left
12:06
plant_enjoyer joined
12:09
jmerelo left
12:26
rindolf joined
12:28
tyil joined
12:57
RobRaku left
13:07
rbt left
13:08
jmerelo joined,
natrys joined
13:20
Altai-man joined
13:21
plant_enjoyer left
13:23
sena_kun left
13:33
maettu joined
13:50
Sgeo joined
13:52
ambs joined
13:57
wamba left
|
|||
lizmat | and another Rakudo Weekly News hits the Net: rakudoweekly.blog/2020/10/19/2020-42-recipes/ | 14:01 | |
tyil | lizmat++ | ||
14:06
patrickb joined,
wamba joined
|
|||
moritz | lizmat++ indeed | 14:06 | |
14:09
frost-lab left
14:16
BenGoldberg joined
14:19
patrickb left
14:35
RobRaku joined
14:40
skids joined
14:49
skids left
14:50
BenGoldberg left
|
|||
[Coke] finds a link to www.apress.com/gp/book/9781484262573 - clicks on math preview. Coke cannot figure out what the "hair at the neck" comment is in relation to. :| | 14:52 | ||
(like, I get it as a standalone Note. I have no idea what it's doing there.) | |||
El_Che | I don't see any hair of neck references | 14:54 | |
jdv79 | its in the "Note" call out thing | 14:56 | |
moritz | that's in reference to the story about doubling the amount of ground for each square on the chess board | ||
jdv79 | its also lost on me | 14:57 | |
lizmat congratulates moritz with twitter.com/taustation/status/1318...3721506816 :-) | 14:58 | ||
[Coke] | ahhhh | 14:59 | |
thank you for finding the reference, moritz. :) | |||
Didn't see the "king" item in the main text before, must have skimmed. | |||
El_Che | jmerelo: your book is wrongly categorized as "Shell Scripting" in O'Reilly Safari: strasbourg.apt-get.be/f/de1ecd3ed1b94128a11f/ | 15:00 | |
15:02
Altai-man left
|
|||
Altreus | I have a Cro::WebSocket::Client object, which has a closer promise. Then I have «whenever $conn.closer -> $c» to handle the websocket closing, which seems to work | 15:08 | |
The problem is that $c appears to be a promise, even if I call $c.result | |||
And $c.result.result | |||
I can't work out what I've done wrong | |||
timotimo | i mean, it's valid to set a promise's result to another promise :D | 15:17 | |
Altreus | yeah but | ||
it's not :D | |||
it's kept with either a string or a message object AFAICT | 15:20 | ||
timotimo | i'll have a quick look at the code | ||
Altreus | github.com/croservices/cro-websock...ection.pm6 | 15:21 | |
84 and 104 | |||
And here is where I handle it, only without my new changes to accept $c github.com/shuppet/p6-api-discord/...akumod#L90 | 15:24 | ||
timotimo | yeah line 84 closes the closer with itself as the value | 15:25 | |
Altreus | oh | ||
that seems silly | |||
timotimo | so you'll get $c.result result in $c, so you can infinitely .result and get the same thing every time | ||
Altreus | I think it intends to use the message | ||
timotimo | yeah that looks like an accident | ||
yeah | |||
Altreus | i fix locally | ||
make pr | |||
get famous for contributing | |||
:D | |||
timotimo | good | 15:27 | |
Altreus | uh I fixed it and now it's not closing any more | 15:28 | |
timotimo | what does your fix look like, then? :) | ||
Altreus | $!closer.keep($_) if $!closer; | ||
timotimo | yeah that's not correct tho :) | ||
Altreus | I mean | ||
wait I wanted .defined | 15:29 | ||
or not at all | |||
timotimo | yes defined | ||
Altreus | it should be defined I think | ||
jmerelo | El_che oh no | 15:34 | |
El_Che: perl legacy is still following us... | 15:35 | ||
Altreus | github.com/croservices/cro-websocket/pull/30 ta-da | 15:36 | |
never mind, beaten by a bot | |||
[Coke] | m: my $closer; $closer?.keep('eek') | 15:40 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Bogus postfix at <tmp>:1 ------> 3my $closer; $closer7⏏5?.keep('eek') expecting any of: infix infix stopper statement end statement modifier … |
||
[Coke] | m: my $closer; $closer.?keep('eek') | 15:41 | |
camelia | ( no output ) | ||
[Coke] | ^^ | ||
m: my $closer; $closer.keep('eek') #vs | |||
camelia | No such method 'keep' for invocant of type 'Any'. Did you mean any of these: 'grep', 'keys'? in block <unit> at <tmp> line 1 |
||
15:42
wamba left
15:43
wamba joined
|
|||
Altreus | m: my $closer = Promise.new; $closer.break; $closer.?keep('eek'); | 15:45 | |
camelia | Access denied to keep/break this Promise; already vowed in block <unit> at <tmp> line 1 |
||
Altreus | bah | 15:46 | |
15:59
Some-body_ joined
|
|||
timotimo | yeah, .? is for if you don't know if the method exists | 16:00 | |
16:00
DarthGandalf left,
Some-body_ is now known as DarthGandalf
16:02
andrzejku joined
16:04
RobRaku left
|
|||
Altreus | oya | 16:07 | |
well that's kind of the case but not really the semantics | |||
16:08
DarthGandalf left
16:10
maettu left,
jmerelo left
16:11
DarthGandalf joined
|
|||
[Coke] | timotimo: it also protects against undefined LHS. | 16:13 | |
timotimo | oh? | ||
[Coke] | ... hurm. depending on level of undefined. | ||
timotimo | m: say Str.?chars | 16:14 | |
camelia | Use of uninitialized value of type Str in string context. Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful. 0 in block <unit> at <tmp> line 1 |
||
[Coke] | if it's an Any, it'll DTRT. if it's a class object, then you might still end up invoking it. Yah, nevermind. | ||
timotimo | maybe you were thinking of Nil, which "has every method" | ||
[Coke] | I'm used to it being used as like a nil protector in other languages, my bad. | ||
16:19
Doc_Holliwood joined
|
|||
Doc_Holliwood | is there a good way to count the number of things in a list that satisfy a condition? | 16:20 | |
i'm not interested in the things themselves, only the count | |||
if not, how about @things.grep( * < 1, :c ) # :c for count | 16:21 | ||
or @things.elems( * < 1 ) | |||
lizmat sorta recalls implementing something like that | |||
Doc_Holliwood is sorta happy to hear that | 16:22 | ||
lizmat looks at the code and doesn't see it :-( | 16:23 | ||
Doc_Holliwood | oh and what the heck does "Malformed postfix call (only alphabetic methods may be detached)" mean | ||
i'm trying to use a sub as in my &x = * + 1; @things.&x but it blow with that error | 16:24 | ||
@things.grep.&x rather | |||
lizmat | m: my @a = ^100; my int $count; @a.grep: { ++$count if $_ %% 3; False }; say $count # Doc_Holliwood | 16:25 | |
camelia | 34 | ||
lizmat | pretty sure that's pretty fast as the False makes sure no values are actually produced by the Seq | ||
Doc_Holliwood | that's uglier than the american president :D | ||
lizmat | making $count an atomic int, you could even hyper it | 16:26 | |
Doc_Holliwood | it also has a side effect | 16:27 | |
but thanks | 16:28 | ||
still thinking though, that should be builtin | |||
dakkar | m: my @things=1..10; say 0+@things.grep({ $_ %% 2 }) | ||
camelia | 5 | ||
dakkar | like that? | ||
lizmat | dakkar: you don't need the 0 for that | ||
Doc_Holliwood | yes, but that still produces the elements of the sequence | ||
dakkar | oh right, `+` is not a nop in rake | ||
16:30
Noisytoot left,
Noisytoot joined
|
|||
SmokeMachine | m: my @a = ^100; say @a.grep({ $_ %% 3 }).elems # while not simply this? | 16:33 | |
camelia | 34 | ||
lizmat | SmokeMachine: that works, but is wasteful CPU wise, because it still produces all the values that match the condition | 16:34 | |
16:35
maggotbrain joined
|
|||
lizmat | and then counts the number of elems in the resulting Seq | 16:35 | |
and since the iterator is not a PredictiveIterator, that means producing all of the values :-( | |||
SmokeMachine | it's a Seq, couldn't it not produce the values it .elems is called (as Red does?) | 16:36 | |
lizmat | it can only do that reliably if it is a PredictiveIterator | 16:37 | |
16:37
ufobat left
|
|||
lizmat | please check github.com/rakudo/rakudo/blob/mast...eq.pm6#L58 | 16:38 | |
SmokeMachine | but can't `Seq.grep(&cond).elems` be equivalent to `my $count = 0; Seq.grep: { $count++ if cond($_); False }`? | 16:41 | |
lizmat | lemme see what breaks if I do that :-) | 16:43 | |
SmokeMachine | :) | 16:44 | |
lizmat | building now | 16:46 | |
I think I remember now why that won't work: | 16:47 | ||
it's very easy, under the hood, to create this situation: if foo.elems { for foo { ... } } | |||
if .elems already exhausts the Seq, the for won't work | |||
16:49
maettu joined
|
|||
SmokeMachine | but would the if be needed on that case? if there is no elements, the for won't loop... | 16:51 | |
I know that's not related, Rakudo's seq are much deeper than Red's ResultSeq, but just because I like the way it works: usercontent.irccloud-cdn.com/file/.../image.png | 16:52 | ||
lizmat | gist.github.com/lizmat/2b0975d71d5...a10bae452f # SmokeMachine: the result | 16:54 | |
SmokeMachine | lizmat: I'm not suggesting that, but does the errors stop if you .cache it before .elems? (I now that's not a fix... I'm just curious (I can test it here if you are not curious enough)) | 16:57 | |
lizmat | but the .cache is exactly what we're trying to prevent ? | 16:58 | |
and yes, I've lost my curiosity there, been there, tried that and failed again now :-) | |||
SmokeMachine | I assumed the error on the tests were because it was trying to use the now exhausted Seq... | 16:59 | |
17:10
jmerelo joined,
dakkar left
17:13
skids joined
17:16
domidumont left
|
|||
lizmat | SmokeMachine: yup | 17:16 | |
17:17
domidumont joined
|
|||
SmokeMachine | So that’s why I’m going to test caching it, if all tests pass, that’s the only problem... | 17:17 | |
17:18
domidumont left
|
|||
lizmat | SmokeMachineL: not sure what you're trying to achieve, but don't let that stop you :-) | 17:20 | |
SmokeMachine | :) | 17:22 | |
But I think I’ll have to leave that to a future test... (I should be fixing Red bugs) | 17:23 | ||
17:39
wamba left
17:41
BenGoldberg joined
17:47
andrzejku left
17:50
Doc_Holliwood left
17:56
ambs left
18:00
Kaeipi joined,
Kaiepi left,
mowcat joined,
wamba joined
18:09
Doc_Holliwood joined
18:15
BenGoldberg left
18:18
andrzejku joined,
Kaeipi left
18:23
Sauvin left
18:33
jmerelo left
18:45
abraxxa left
18:46
abraxxa joined
19:18
aborazmeh joined,
aborazmeh left,
aborazmeh joined
19:26
|oLa| joined
|
|||
Geth | doc: olorin37++ created pull request #3669: Correct typo |
19:32 | |
19:34
nicholatian joined,
nicholatian left
19:35
nicholatian joined,
|oLa| left
|
|||
Geth | doc: f247ee4cd2 | (Jakub A. G)++ (committed using GitHub Web editor) | doc/Language/haskell-to-p6.pod6 Correct typo |
19:37 | |
doc: 2e85facd96 | (Will Coleda)++ (committed using GitHub Web editor) | doc/Language/haskell-to-p6.pod6 Merge pull request #3669 from olorin37/patch-2 Correct typo |
|||
linkable6 | Link: docs.raku.org/language/haskell-to-p6 | ||
19:47
stoned75 left
19:51
maettu left
19:58
skids left
20:01
natrys left
20:08
aborazmeh left
20:16
andrzejku left
20:18
rypervenche left
20:19
Kaiepi joined
20:23
rypervenche joined
20:35
RobRaku joined
21:05
RobRaku left
21:07
BenGoldberg joined
21:19
rindolf left
21:25
frank_ joined
21:32
frank_ left
21:40
vrurg_ joined,
BenGoldberg left
21:42
vrurg left
22:08
cpage left,
cpage_ joined
22:10
cpage_ left
22:11
cpan-raku left
22:12
cpan-raku joined,
cpan-raku left,
cpan-raku joined
22:13
cpage joined
22:23
skids joined
22:28
wamba left
22:36
Sgeo left
22:40
Sgeo joined
22:51
Doc_Holliwood left
23:05
pecastro left
23:07
Manifest0 left
23:32
moony left
23:39
HarmtH left
23:40
HarmtH joined
23:45
Manifest0 joined
23:47
moony joined
|