🦋 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.
xinming Anyone here can give me some hint on writing promises chain, which is something like, while ($data = fetch) { process-data($data) } ? 01:27
I've thought a white, Still not much clue about it.
xinming Just skeleton is fine, I know how to chaining, but just stuck with how I can break the Promise 01:33
timotimo i'm not entirely sure how you mean, how does this involve promises, how does it involve chaining? 01:38
xinming hmm, let me think about it 01:42
guifa2 I swear when I get done with this refactoring of CLDR I'm never coming back to it lol 02:07
guifa2 everytime I get half way done I come up with a better way =\ 02:08
xinming timotimo: termbin.com/mx2z 02:33
timotimo: It's soemthing like this, building a promise chain with data received.
timotimo it kind of looks like you want a single worker that receives from a channel and does stuff, like in a loop that keeps a variable around to hold what the pasted code uses prev-p.result for 02:38
xinming timotimo: yea, something like that, I've been stucking in this loop for an hour. :-(
timotimo really depends what you want to get out of the whole thing 02:39
xinming receive a data, and build a promise
the promise requires previous previous value to be processed.
timotimo where does the promise need to go?
xinming Do you mean we don't need promise in this case? 02:40
timotimo not sure yet
xinming timotimo: actually, $channel.recevie part is also a promise.
timotimo it feels like this is being done to manage the queue of incoming requests/data somewhere else than the channel 02:41
do you want something resembling "the current promise"/"the latest promise"?
xinming Nope 02:43
Xliff m: say Int !=:= Mu
camelia True
xinming I just want to ensure these promises are chained as long as values arrived.
Xliff m: class A { }; say A !=:= Mu 02:44
camelia True
timotimo but it's not important that it's a Promise that is used?
m: my Channel $c .= new; $c.send("first"); Supply.interval(1).tap({ $c.send($_) }); start react { my $last; whenever $c { $last = $last.comb.pick(5).join("") ~ $_; $last.say } }; sleep 6 02:45
camelia Unhandled exception in code scheduled on thread 7
A react block:
in code at <tmp> line 1

Died because of the exception:
No such method 'comb' for invocant of type 'Any'
in block at <tmp> line 1
timotimo m: my Channel $c .= new; $c.send("first"); Supply.interval(1).tap({ $c.send($_) }); start react { my $last = ""; whenever $c { $last = $last.comb.pick(5).join("") ~ $_; $last.say } }; sleep 6
camelia first
fitsr0
0irfs1
1rsf02
0rf1s3
1srf34
rs4315
r145s6
timotimo does this seem like it fits your use case? 02:46
you also wanted to have something that handles breaking the promise, right? 02:47
m: my Channel $c .= new; $c.send("first"); Supply.interval(1).tap({ $c.send($_) }); start react { my $last = ""; whenever $c { $last = $last.comb.pick(5).join("") ~ $_; $last.say; die "oh no" if rand < 0.2 }; CATCH { default { .say; $c.close; } } }; sleep 8 02:48
camelia first
Unhandled exception in code scheduled on thread 7
fitrs0
0sftr1
rt1s02
rt0s13
1st034
0341s5
A react block:
in code at <tmp> line 1

Died because of the exception:
oh no
in block at <tmp> line 1
timotimo ah you're back 02:55
what was the last message of mine you saw?
i guess you could probably look at the irclog?
xinming timotimo: I don't see any log, I just have the last message I wrote. 02:57
xinming | Just a moment, i'll rewrite my example.
timotimo i did not get that line :)
m: my Channel $c .= new; $c.send("first"); Supply.interval(1).tap({ $c.send($_) }); start react { my $last = ""; whenever $c { $last = $last.comb.pick(5).join("") ~ $_; $last.say } }; sleep 8
camelia first
irfts0
0trfs1
st0rf2
tfsr23
f2rst4
t4sr25
t45r26
64tr27
timotimo do you like it? 03:02
xinming timotimo: I'll check, sorry, was rewriting another version of that example 03:09
timotimo m: my Channel $c .= new; $c.send("first"); Supply.interval(1).tap({ say "sending $_"; $c.send($_) }); start react { my $last = ""; whenever $c { $last = $last.comb.pick(5).join("") ~ $_; $last.say; sleep 1.25 } }; sleep 8 03:10
camelia sending 0
first
sending 1
tfsri0
sending 2
tsfr01
sending 3
1tsfr2
sending 4
sending 5
rt1s23
sending 6
2srt34
sending 7
23rts5
timotimo ^- demonstrates that it'll only process something that was sent if the previous processing step has finished 03:11
which is what i think your promise chaining was needed for
xinming timotimo: termbin.com/p0ri 03:13
Xliff m: Supply.interval(1).tap({ .say }); sleep 3; 03:17
camelia 0
1
2
3
xinming timotimo: termbin.com/uc3uu <--- This one with what I'm trying to do. 03:18
Xliff m: Supply.interval(1.5).tap({ .say }); sleep 3;
camelia 0
1
2
xinming timotimo: and I just realized, that I have to use inifinite loop.
BBL 03:19
timotimo my code does the infinite loop if you "react" instead of "start react" 03:29
xinming timotimo: termbin.com/m1iw This is my final working version. 03:37
timotimo: I don't understand your code very well before, Will check it again. :-)
timotimo my "react whenever $c" is also an infinite loop, unless you close the channel 03:40
xinming yea, understood now 03:44
Still can't think in raku
timotimo :) 03:51
in this case, the react/whenever is equivalent to an infinite loop with $c.receive 03:55
guifa2 Any great (===simple, else I'll go more complex) way to supress some keys in a subclass of Hash? 04:34
I tried overriding .keys, but .kv and .values are unaffected
ben_ 05:07
holyghost guifa2: I use .kv 05:20
tellable6 holyghost, I'll pass your message to guifa2
Geth doc: 3136df50ae | JustThisGuyAZ++ (committed by Juan Julián Merelo Guervós) | doc/Language/testing.pod6
Update testing.pod6

Fix anchors in links under the "Testing exceptions" section.
06:29
linkable6 Link: docs.raku.org/language/testing
xinming SmokeMachine: Does `@result-seq .= grep({ });` work as expcectd? 08:04
holyghost racul compiles (symboltable with hawking boltzmann random approx. done), see github.com/theholyghost2/racul 08:09
I might PR into raku when there's a piece of the compiler done, anyhow
SmokeMachine xinming: it seems it doesn't :( but $result-seq does...
xinming: www.irccloud.com/pastebin/t22JGhc6/ 08:10
suman how can I check from within raku if gcc is present in the system? 08:11
SmokeMachine xinming: it seems I need to write a STORE() to Red::ResultSeq 08:12
CAPTCHA_REQUIRED You could also exec cc and check if it's stdout contains the string gcc 08:33
*xec cc -v 08:34
xinming Is there channel log here? 08:34
I'll check log
CAPTCHA_REQUIRED But that would check if gcc is set as the current c compiler rather than if it is available on the system
xinming m: class AA { has $.a; has $.b; has $.c; }; my $obj = AA.new: :a(1), :b(2), :c(3); %(<a b c>.map({ $_ => $obj."$_"(); })).raku.say; 08:35
camelia {:a(1), :b(2), :c(3)}
xinming Is there a shorter version of <a b c>.map({ $_ => $obj."$_"() }) ?
SmokeMachine: Yea, another bug, I discovered it just now, but busy with other things, so no time to isolate the real issue.
SmokeMachine xinming: what's the bug? 08:37
xinming the @result-seq .= grep({ ... }) 08:41
SmokeMachine: BTW, Can we have a shorter version of <a b c>.map({ $_ => $obj."$_"() }) ?? 08:43
Geth doc: 5b5735fbe6 | (Stoned Elipot)++ (committed by Juan Julián Merelo Guervós) | doc/Language/testing.pod6
Add back PERL6_TEST_DIE_ON_FAIL
09:14
doc: 56b9b69d1e | (Stoned Elipot)++ (committed by Juan Julián Merelo Guervós) | doc/Language/testing.pod6
Document {RAKU,PERL6}_TEST_TIMES
linkable6 Link: docs.raku.org/language/testing
SmokeMachine xinming: I could swear we did... but I could find it... 09:23
JJAtria[m] The link in github.com/raku/ecosystem-unbitrot still points to perl6.github.io/ecosystem-unbitrot 09:24
cpan-raku New module released to CPAN! eigenstates (0.0.3) by 03ELIZABETH 12:25
Xliff Happy Thanksgiving, everyone! 13:06
xinming SmokeMachine: I think there is another bug, Which is, `Model.^all.grep({ .id in @!has-many.map({ .xx-id }) });` is different from `Model.^all.grep({ .id in @.has-many.map({ .xx-id }) });` 13:08
xinming SmokeMachine: Please notice the @!has-many vs @.has-many, I just encountered this, not much time to go deeper now, Later will dive into this when I get time. 13:09
SmokeMachine xinming: really?! I'll need to take a look, would you mind to open a issue, please? 13:11
holyghost Xliff : happy TG ! take a look at racul : github.com/theholyghost2/racul 13:12
Xliff : it's Scheme for inside racul
s/racul/raku
symbol table is ok, now I have to do the parser of the compiler/REPL 13:13
xinming SmokeMachine: Later, when I have time, I'll also submit the issue with test case.
SmokeMachine xinming: thanks 13:14
holyghost It should load scheme code and execute that in raku with a compiler pattern. You then write Scheme files which can e.g. be persistent in memory
holyghost It can become a Scheme with futures even, I tried to build in some OO 13:20
Xliff holyghost: Good. I'm glad you are progressing with your work.
Xliff I am doing the same with mine. 13:20
Passed 460kLOC just a while ago.
Not familiar with Scheme, though so.... :/
holyghost Coolness, Scheme is all right, don't worry about it 13:23
xinming SmokeMachine: How do we do DESC sorting please? 13:29
SmokeMachine: The default is asc
Xliff xinming: Anti sort?
xinming .sort({ $^a <=> $^b }) ??
Xliff: in sql using Red 13:30
.sort({ $^b <=> $^a }) ??
SmokeMachine xinming: `Model.^all.sort: -*.col`
m: ^10 .sort: -* # xinming: as here 13:31
camelia ( no output )
SmokeMachine m: say ^10 .sort: -* # xinming: as here
camelia (9 8 7 6 5 4 3 2 1 0)
xinming Ok, thanks. 13:32
Xliff SmokeMachine: Is that explanation in the tests or the docs? 13:34
SmokeMachine Xliff: not sure... 13:35
Xliff Hmmm.... looks like t/08-best-tree.t is the earliest.
No mention in docs/ 13:36
SmokeMachine: Where would something like that go in docs/ ? 13:37
SmokeMachine sort on tests: www.irccloud.com/pastebin/a51XAa5T/
Xliff: not sure, maybe here? fco.github.io/Red/api/Red/ResultSeq 13:38
Xliff Yeah. Am editing. 13:39
SmokeMachine Xliff: I think we need to improve this section and show it better how to use the different ways of using the ResultSeq methods 13:40
Xliff: thanks! 13:41
Xliff SmokeMachine: paste.centos.org/view/33c97e47 13:47
I can't submit a PR because I am using an older fork. 13:48
SmokeMachine Xliff: it's looking good, but it's generated by this (github.com/FCO/Red/blob/master/lib....pm6#L262) 13:50
Xliff: ok, I'll apply that after $dayjob...
Xliff: thank you very much! 13:53
Xliff SmokeMachine: yw! 14:05
SmokeMachine and I was thinking... I think it does make sense to support `.sort: *.col <=> *.col` or `.sort: { $^b.col <=> $^a.col}`... 14:07
Xliff How would that work? 14:22
How can you tell what the ordering is from a block?
I agree, that would be a useful alternative. I was about to suggest that, but I ran into that particular question.
Do you run a sample sequence through the sort func and analyze the resutls? 14:23
SmokeMachine Xliff: if it expects 2 params: it will create 2 alias from the Model, run the block passing both alias. if the result is a Red::AST::ShipOP and both sides of it is the same column from the same base model, it uses that column to order, if the first model I've passed is the left model it's DESC, otherwise it's ASC. And if it's anything different from that, I order like: order by <left> - <right> ASC 14:28
Xliff: that's the kind of stuff does on map and grep... it should be doing that on sort as well
Xliff Um. Wow. 14:30
I think I understood that.
Nice job.
SmokeMachine Xliff: when you call a "column method" on a model's object type, it returns the Red::Column of that column, and using operators on it returns Red::AST, that that's how I "know" what a block is doing... 14:31
Xliff: there is also a interesting thing when you call Red::AST.Bool inside of a map/grep block: if it already "saw" that call, it return False, and if it haven't seen that, it return True and run the block again... that way we can find the conditionals and what every possibility should return... 14:33
Xliff: that's how we can do stuff like this: www.irccloud.com/pastebin/0bGGkYTb/ 14:37
Xliff: or this www.irccloud.com/pastebin/AKjTDHji/ 14:39
Xliff Are given / when blocks supported? 14:40
SmokeMachine Xliff: but I plan to change that when we have RakuAST and custom compiler passes... 14:41
Xliff Yes, RakuAST will hopefully make a lot more possible.
Looks like we will have to wait a bit longer for it, though.
SmokeMachine Xliff: no given / when yet... I haven't done ~~ yet... 14:42
Xliff Ah! So when ~~ is complete, you will pretty much have what you need, right? 14:45
SmokeMachine Xliff: yes, I think so
Xliff: so many things to do... and so small time to do it... :( I really need help... 14:46
Xliff I hear that. You and me both. 14:47
If I even understood half of what you are doing with the AST, I would do what I could. 14:48
SmokeMachine Xliff: that's not that complex: github.com/FCO/Red/blob/1ebefda78d...de.pm6#L56 14:51
Xliff SmokeMachine: That's not all that clear to me. 15:01
For one thing, IO don't know what you have in @values. That's a LONG bit of code for %first-key 15:02
How would you go about handling ~~, for example?
SmokeMachine Xliff: I’ll probably make is return an Red::AST... so, on that point there will be no ~~ anymore... 15:07
SmokeMachine Xliff: when you run func it returns (probably) an array of Red::AST trees 15:10
Xliff So you would do what? Overload infix:<~~>?
Or that and ACCEPTS?
SmokeMachine Xliff: it depends... 15:11
Xliff SmokeMachine: Trying to see if I can help ya out, here...
:)
SmokeMachine m: class C { method ACCEPTS (|) { 42 } }; say C ~~ C # Xliff: if it prints 42, them implement ACCEPTS otherwise, ~~ 15:13
camelia True
SmokeMachine ~~ it is
Xliff m: say 42.ACCEPTS(42) 15:23
camelia True
Xliff SmokeMachine: Are you sure?
m: class C { method ACCEPTS (|) { True } }; say False ~~ C; say True ~~ C; say "A" ~~ C; 15:24
camelia True
True
True
Xliff m: class C { method ACCEPTS (|) { True } }; say (1, 2, 3) ~~ C 15:25
camelia True
Xliff m: class C { method ACCEPTS (|c) { c ~~ List } }; say False ~~ C; say True ~~ C; say (1, 2, 3) ~~ C
camelia False
False
False
Xliff m: class C { method ACCEPTS (|c) { c ~~ List } }; say False ~~ C; say True ~~ C; say (1, 2, 3).List ~~ C
camelia False
False
False
Xliff Hmmm...
m: class C { method ACCEPTS (|c) { c ~~ Seq } }; say False ~~ C; say True ~~ C; say (1, 2, 3).List ~~ C
camelia False
False
False
Xliff m: class C { method ACCEPTS (\) { c ~~ Seq } }; say False ~~ C; say True ~~ C; say (1, 2, 3).List ~~ C 15:26
camelia 5===SORRY!5=== Error while compiling <tmp>
Expected a term, but found either infix ~~ or redundant prefix ~
(to suppress this message, please use a space like ~ ~)
at <tmp>:1
------> 3class C { method ACCEPTS (\) { c ~~7⏏5 Seq } }; …
Xliff m: class C { method ACCEPTS (\c) { c ~~ (List, Seq, Array).any } }; say False ~~ C; say True ~~ C; say (1, 2, 3).List ~~ C
camelia False
False
True
SmokeMachine m: class C { }; multi infix:<~~>(C, C) { 42 }; say C ~~ C # Xliff: it seems ~~ will not be possible as well 15:30
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot override infix operator '~~', as it is a special form handled directly by the compiler
(consider implementing an ACCEPTS method)
at <tmp>:1
------> 3class C { }; multi infix:<~~>7⏏5(C,…
Xliff SmokeMachine: So why not override ACCEPTS and see if that will work? 15:32
SmokeMachine Xliff: I think it will need to eat till RakuAST (now I'm remembering it... I think that's the reason I haven't done that yet...)
Xliff SmokeMachine: OK. Fair enough.
SmokeMachine Xliff: it seems ~~ only returns boolean... and we need to return Red::AST... 15:33
Chdobagne Is it possible in Raku to evaluate the right part of a regex. The equivalent of the modifier e in perl 5. 15:35
lizmat Chdobagne: could you show what you mean in Perl ? 15:38
Chdobagne In perl 5 s/ .../ .../ e alows to evaluate the right part. 15:40
SmokeMachine m: say S/(\d+)/{ $0 + 1 }/ given 41 # ChoppedBacon: like this? 15:41
camelia 42
lizmat SmokeMachine++ 15:42
Xliff m: ("Hello" ~~ s« 'Hell' (.) » = $0.Str.succ).say 15:43
camelia Cannot modify an immutable Str (Hello)
in block <unit> at <tmp> line 1
Xliff m: my $a = "Hello" ; $a ~~ s« 'Hell' (.) » = $0.Str.succ); $a.say
camelia 5===SORRY!5=== Error while compiling <tmp>
Unexpected closing bracket
at <tmp>:1
------> 3o" ; $a ~~ s« 'Hell' (.) » = $0.Str.succ7⏏5); $a.say
Xliff m: my $a = "Hello" ; $a ~~ s« 'Hell' (.) » = $0.Str.succ; $a.say
camelia p
Xliff ^^ Another method
m: my $a = "Hello" ; $a ~~ s« ( 'Hell' ) » = $0.uc; $a.say # Another way to look at it 15:44
camelia HELLo
Chdobagne I try to translate this perl 5 program : $a = 1; print ("$a\n") and $a =~ s/((\d)\2*)/length($1).$2/ge while length($a) < 64; in Raku. 15:47
Xliff m: $a = 1; $a ~~ s:g/ ((\d)\2*) /{ $0.Str.chars }.{ $1.Str }/ while $a.chars < 64; 15:50
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3<BOL>7⏏5$a = 1; $a ~~ s:g/ ((\d)\2*) /{ $0.Str.c
Xliff m: my $a = 1; $a ~~ s:g/ ((\d)\2*) /{ $0.Str.chars }.{ $1.Str }/ while $a.chars < 64; $a.say
camelia 5===SORRY!5=== Error while compiling <tmp>
Unrecognized backslash sequence: '\2'. Did you mean $1?
at <tmp>:1
------> 3my $a = 1; $a ~~ s:g/ ((\d)\27⏏5*) /{ $0.Str.chars }.{ $1.Str }/ while $
Xliff m: my $a = 1; $a ~~ s:g/ ((\d)2*) /{ $0.Str.chars }.{ $1.Str }/ while $a.chars < 64; $a.say
camelia Use of Nil in string context
1...............................................................
in block at <tmp> line 1
Use of Nil in string context
in block at <tmp> line 1
Use of Nil in string context
in block at <tmp> line 1
U…
Xliff m: my $a = 1; $a ~~ s:g/ ((\d)2*) /{ $0.Str.chars }{ $1.Str }/ while $a.chars < 64; $a.say 15:52
Hrm.
camelia (timeout)Use of Nil in string context
in block at <tmp> line 1
Use of Nil in string context
in block at <tmp> line 1
Use of Nil in string context
in block at <tmp> line 1
Use of Nil in string context
in block at <tmp> line 1…
Xliff m: my $a = 1; $a ~~ s:g/ ((\d)2*) /{ $0.chars }{ $1 }/ while $a.chars < 3; $a.say
camelia (timeout)Use of Nil in string context
in code at <tmp> line 1
Use of Nil in string context
in code at <tmp> line 1
Use of Nil in string context
in code at <tmp> line 1
Use of Nil in string context
in code at <tmp> line 1
Us…
15:53
SmokeMachine m: .say for (1, { S:g/(\d)$0*/{ $/.chars }{ ~$0 }/ } ... *.chars > 64) 16:09
camelia 1
11
21
1211
111221
312211
13112221
1113213211
31131211131221
13211311123113112211
11131221133112132113212221
3113112221232112111312211312113211
1321132132111213122112311311222113111221131221
111312211312111312311211131122211…
Xliff SmokeMachine++
SmokeMachine Chi1thangoo: ^^ 16:09
SmokeMachine m: .say for 1, { S:g/(\d)$0*/{ $/.chars }{ ~$0 }/ } ... *.chars > 64 16:13
camelia 1
11
21
1211
111221
312211
13112221
1113213211
31131211131221
13211311123113112211
11131221133112132113212221
3113112221232112111312211312113211
1321132132111213122112311311222113111221131221
111312211312111312311211131122211…
Chi1thangoo SmokeMachine: ? 16:21
Xliff Chdobagne logged out 16:22
Chi1thangoo I see
strange timing
Xliff Yah.
SmokeMachine Chi1thangoo: sorry... I meant Chdobagne 16:23
Chi1thangoo no problem, I was just confused haha
Xliff :) 16:24
Geth doc: dfd7494d8a | (Stoned Elipot)++ | doc/Language/testing.pod6
Fix links to Test module's subroutines
20:10
linkable6 Link: docs.raku.org/language/testing
pkmnx I was looking at: github.com/Raku/rakudoc & saw an error. 21:07
a MAIN call allows for a parameter, per use case from docs: raku -Ilib bin/rakudoc -d=../doc/doc IO 21:08
pkmnx rakudoc/lib/Rakudoc/CMD.rakumod throws an error 21:09
94 @doc-dirs = cross :with({$^a.add($^b)}), @dirs, @subdirs;
its an IO path add.
could be fixed in a few ways, but w/ "... $^a.IO.add ..." 21:10
otherwise $a has a string, given -d from command line ... 21:11
MasterDuke pkmnx: good catch. feel free to create an issue in github (or a PR fixing it) 21:18
pkmnx ok. I'll push it in ...
pkmnx just wanted to ask whether it was an actual thing to care about .. 21:19
guifa2 Okay, API design question 21:24
tellable6 2020-11-26T05:20:19Z #raku <holyghost> guifa2: I use .kv
guifa2 Most places in CLDR, there's a strong hierarchical structure, so if I want the long, standalone, way to say "November" in Asturian, I say $data.calendars.gregorian.months.stand-alone.wide[11] --> 'payares' 21:26
But in a few places, there are places where that structure falls apart because of grammatical features like gender, number, and case.
It would feel weird to require $data.units.meters.nominal.neuter.other to get '{0} meters' for English, given we only care about the number 21:28
guifa2 I'm guessing I could try to do something like $data.units.meters(number => 'other'), but it feels weird abusing the CALL-ME function to do selection like that 21:29
But maybe that's just me? Any thoughts?
Geth ecosystem: lizmat self-assigned Modules by deceased community members github.com/Raku/ecosystem/issues/569
3202c6f8ce | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | META.list

that have been moved to raku-community-modules
21:36
ecosystem: 22747c227c | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | META.list
Update URLs of /perl6/ that have move to community modules
22:15
Geth ecosystem: 3168d76819 | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | META.list
Update URL's or perlpilot's modules that were moved

to raku-community-modules
22:53
Geth ecosystem: 9736762fed | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | META.list
Update supernovus URLs of modules that have moved
23:08
lizmat and that concludes my hacking for today
MasterDuke lizmat++ 23:10