🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 8 June 2022.
habere-et-disper It would seem wonderful/magical to me if a recursive solution could be made dynamic with a single keyword, ie that `state` could apply to a `multi`... 08:28
But I see:
# Cannot use 'state' with individual multi candidates.
# Please declare an state-scoped proto instead
Nemokosch what would this mean? 08:31
habere-et-disper I'm hoping it would cache the results, so it reduces the number of calls a recursive solution makes... 08:34
Something like turning 08:35
m: multi fib (  0 ) { 0 }
camelia ( no output )
habere-et-disper multi fib (  1 ) { 1 }
multi fib ( \n ) {
    fib( n - 1 ) + fib( n - 2 )
}
Nemokosch why don't you use "is cached", then?
habere-et-disper Into just:
m: state multi fib (  0 ) { 0 }
camelia ===SORRY!=== Error while compiling <tmp>
Cannot use 'state' with individual multi candidates. Please declare an state-scoped proto instead
at <tmp>:1
------> state multi fib (  0 ) { 0 }⏏<EOL>
habere-et-disper state multi fib (  1 ) { 1 }
multi fib ( \n ) {
    fib( n - 1 ) + fib( n - 2 )
}
I don't know how to use `is cached`. Sounds wonderful. Reading docs now. :) 08:37
Nemokosch I didn't even know a function can be made static or how that would make sense
anyway, it really seems to me that you just want cached
habere-et-disper Hmmm... 08:44
m: use experimental :cached; 08:45
camelia ( no output )
habere-et-disper multi fib ( 0 ) is cached { 0 }
multi fib ( 1 ) is cached { 1 }
multi fib ( \n ) {
    fib( n - 1 ) + fib( n - 2 )
}
When I run this locally, I get: <Constraint type check failed in binding to parameter '<anon>'; expected 0 but got 10>
lizmat habere-et-disper: confirmed 08:49
I'd suggest to drop the "is cached" 08:50
habere-et-disper That runs, but does not seem to cache it... 08:54
m: use experimental :cached;
camelia ( no output )
habere-et-disper my $GLOBAL = 0;
multi fib ( 0 ) { $GLOBAL++; 0 }
multi fib ( 1 ) { $GLOBAL++; 1 }
multi fib ( $n ) {
    fib( $n-1 ) + fib( $n-2 )
}
say fib 10;
say $GLOBAL;
lizmat ok, worthy of an issue 08:55
workaround: drop the "is cached" on the multis, add a "proto fib(|) is cached {*}" 08:56
habere-et-disper Or maybe it is? I'm trying to count the number of times it is called. I get 55/89
Thanks, that works! @lizmat++ 08:57
I get 55/2 now!
lizmat it is some kind of bug in dispatch of callsame, something that was semi-recently changed, so perhaps something has gone wrong there 08:58
habere-et-disper: please also remember that "is cached" is *not* threadsafe in its current implementation 08:59
habere-et-disper Noted. Experimental. Raku: the R&D division of perl. :) 09:00
lizmat that's not how I see that :-) 09:01
Nemokosch more like 09:06
Raku: "they promised us unicorns"
lizmat perhaps, but "they" left the project 09:08
so you will have to make do with what is here now 09:09
with an occasional rainbow
Nemokosch Well this opens up the possibility to make junctions less anglocentric among other things 😛 09:11
japhb Anyone know the process to send in a TRC talk recording? I must be missing something. 09:33
lizmat I've pinged @andrewshitov on Twitter 09:47
japhb Thanks lizmat. 09:48
lizmat if I remember from last year, just make it available for download somewhere and tell Andrew the URL by mail / twitter / whatever :-) 10:02
japhb Yeah, he sent me email. I uploaded it and shared it with him. :-) 10:10
And now ... sleep?
lizmat well deserved!
[Coke] . 14:42
SmokeMachine m: proto sub fib(UInt) is pure { * }; multi sub fib(1) { 1 }; multi sub fib(UInt $num) { fib($n - 1) + fib $n - 2 }; say fib 10 18:02
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$n' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> ) { 1 }; multi sub fib(UInt $num) { fib(⏏$n - 1) + fib $n - 2 …
SmokeMachine 19:02 <SmokeMachine> m: proto sub fib(UInt) is pure { * }; multi sub fib(1) { 1 }; multi sub fib(UInt $n) { fib($n - 1) + fib $n - 2 }; say fib 10 18:03
SmokeMachine m: proto sub fib(UInt) is pure { * }; multi sub fib(1) { 1 }; multi sub fib(UInt $n) { fib($n - 1) + fib $n - 2 }; say fib 10 18:03
camelia Constraint type check failed in binding to parameter '<anon>'; expected UInt but got Int (-1)
in sub fib at <tmp> line 1
in sub fib at <tmp> line 1
in sub fib at <tmp> line 1
in sub fib at <tmp> line 1
in sub fib at <tmp> line 1
SmokeMachine m: proto sub fib(UInt) is pure { * }; multi sub fib(1) { 1 }; multi sub fib(0) { 1 }; multi sub fib(UInt $n) { fib($n - 1) + fib $n - 2 }; say fib 10 18:07
camelia 89
SmokeMachine m: proto sub fib(UInt) is pure { * }; multi sub fib(1) { 1 }; multi sub fib(0) { 1 }; multi sub fib(UInt $n) { say “fib($n)”; fib($n - 1) + fib $n - 2 }; say fib 10; BAGIN say “BEGIN” 18:13
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared name:
BAGIN used at line 1
SmokeMachine m: proto sub fib(UInt) is pure { * }; multi sub fib(1) { 1 }; multi sub fib(0) { 1 }; multi sub fib(UInt $n) { say “fib($n)”; fib($n - 1) + fib $n - 2 }; say fib 10; BEGIN say “BEGIN”
camelia BEGIN
fib(10)
fib(9)
fib(8)
fib(7)
fib(6)
fib(5)
fib(4)
fib(3)
fib(2)
fib(2)
fib(3)
fib(2)
fib(4)
fib(3)
fib(2)
fib(2)
fib(5)
fib(4)
fib(3)
fib(2)
fib(2)
fib(3)
fib(2)
fib(6)
fib(5)
fib(4)
fib(3)…
tbrowder [Coke]: doc master branch fails xtest without my pr. so what should i do? i don’t know how to fix the doc test harness problem. 19:41
but i want to submit the revised pr before i forget about it :-D 19:42
Util What is the difference of `$` and `$?` in a Signature, 20:55
as in github.com/rakudo/rakudo/blob/mast...ice.pm6#L3 ?
(SF.pm Raku Study Group wants to know)
lizmat $ means a required positional in which we're not interested, so we didn't bother to give it a name 20:56
$? is an optional positional in which we're not interested, also without name
Util ^^
Util lizmat: Thanks! 20:57
Nemokosch Raku Study Group? What is that? 20:58
Util Nemokosch: In progress right now on Zoom. Feel free to drop in. www.nntp.perl.org/group/perl.perl6...10612.html 21:02
tellable6 Util, I'll pass your message to Nemokosch