🦋 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.
uzl[m] .seen jjmerelo 00:18
tellable6 uzl[m], I saw jjmerelo 2020-05-22T12:13:54Z in #raku-dev: <JJMerelo> This is maybe a bit more recent www.reddit.com/r/rakulang/comments...e_in_raku/
saxon hey guys, i have tried rakudo-pkg on fedora system of mine but it does not come with a documentation like perl. 04:19
is there a way to get the documentation like perldoc? 04:20
ShimmerFairy I don't know of an offline method offhand, but there's docs.raku.org at least 04:22
saxon tbh beautiful documentation in perldoc accessible at terminal is one of the best things about perl. little low on the bandwidth and ram here. 04:25
can i get docs without opening browser? 04:26
tobs I think `zef install p6doc` should get you offline documentation 04:28
which is accessed in the familiar fashion, e.g. p6doc Str.chomp 04:30
saxon tobs: looks cool. thanks! 04:37
suman pastebin.com/NGa4MrW3 04:48
Any help here?
suman m: 'my %hash; 04:54
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1)
at <tmp>:1
------> 3'my %hash;7⏏5<EOL>
expecting any of:
single quote…
suman sub count_each_chars($val) {
tobs suman: '22/7'.chars is different from 22/7.chars 04:57
the former is the literal string of 4 characters, the latter is a Rat object (rational number) which chooses to stringify to "3.142857" which has 8 characters
suman m: 22/7.chars 04:58
camelia WARNINGS for <tmp>:
Useless use of "/" in expression "22/7.chars" in sink context (line 1)
tobs you have to `say` it 04:59
m: say 22/7.chars
camelia 22
suman m: say 22/7.chars
camelia 22
tobs m: say (22/7).chars # ok, parenthesize then
camelia 8
suman @tob gotch it
thank you 05:00
tobs no problem
suman pastebin.com/BDQ8Tdgf 05:01
tobs %hash<$val> does not interpolate the value of $val. You are incrementing the value at literally '$val' each time (as your output shows). Try %hash{$val} instead. 05:05
suman @tobs Yeah it works after that. But I thought %hash<$val> were same as %hash{$val}. Where can I read more on it? 05:07
tobs the best I found is a little blurb here docs.raku.org/language/operators#p...ix_%3C_%3E 05:11
tobs it's a number of hours past bed time here, I can't be of more help :) 05:18
ShimmerFairy m: my %h; my $val = "foo"; %h«$val» = 42; say %h 05:32
camelia {foo => 42}
ShimmerFairy just to make life more fun :P 05:33
Geth doc: 4c49cea5a4 | (Luis F. Uceta)++ | doc/Language/typesystem.pod6
Index :api and add bit of documentation

refs: github.com/Raku/doc/issues/3308
06:49
doc: d2e7fee86f | (Luis F. Uceta)++ | doc/Language/typesystem.pod6
Make changes as requested
linkable6 Link: docs.raku.org/language/typesystem
Geth doc: 6cfab4455c | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | doc/Language/typesystem.pod6
Merge pull request #3316 from uzluisf/master

Index :api and add bit of documentation
Geth ecosystem/JJ-patch-10: 6c1d069627 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Add Test::Script

Another testing module
08:16
ecosystem: JJ++ created pull request #496:
Add Test::Script
08:17
Geth ecosystem/JJ-patch-10: cf7eb17af6 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Force re-check
08:24
ecosystem/JJ-patch-10: ebacdf8456 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Force re-chec,
08:25
Geth ecosystem/JJ-patch-10: 75970bee86 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Eliminates space.
08:30
JJMerelo ^^^ sorry about that... 08:31
Geth ecosystem/master: 5 commits pushed by (Juan Julián Merelo Guervós)++
gfldex lolibloggedalittle: gfldex.wordpress.com/2020/05/25/re...ht-amount/ 08:34
Geth ¦ problem-solving: lizmat assigned to jnthn Issue The Problem Solving Process is not working github.com/Raku/problem-solving/issues/200 09:25
Geth doc: Prince213++ created pull request #3426:
Fix typo & removed extra blank lines
11:47
Geth doc: 7631cf90e6 | (Sizhe Zhao)++ | README.md
Fix typo & removed extra blank lines
11:53
doc: d49c3ec7c2 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | README.md
Merge pull request #3426 from Prince213/readme-improvements

Fix typo & removed extra blank lines
Xliff \o 12:16
Geth doc: Prince213++ created pull request #3427:
Update Chinese translation
12:41
doc: 622f08ad54 | (Sizhe Zhao)++ | resources/i18n/zh/README.zh.md
Update Chinese translation
12:43
doc: b7884987e1 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | resources/i18n/zh/README.zh.md
Merge pull request #3427 from Prince213/zh-cn-translation-update

Update Chinese translation
lizmat PSA: There will not be a Rakudo Weekly News this week. Yours truly needs a break. Please check in again next week! 12:51
El_Che lizmat: if you feel burn out closing in, take whatever tieme you need! 12:54
SmokeMachine m: role Bla[::T] { has T $.a is required; method b(--> T) { $!a } }; Bla[Int].new(:42a).b 12:57
camelia Died with X::TypeCheck::Return
in method b at <tmp> line 1
in block <unit> at <tmp> line 1
SmokeMachine why can't I use T as return type? 12:58
jnthn Because instantiating type varialbes there is NYI
SmokeMachine by type variable you mean ::T? 12:59
jnthn The T after -->
SmokeMachine why is that being instantiated? (sorry, I'm curious) 13:00
is that the same reason of why I can't do something like `--> (::?CLASS, T)`? 13:02
or that should not work at all? 13:03
jnthn It should work. "instantaition" in this context means resolving the T into the correct type, e.g. by compiling it to do a lexical lookup of T rather than hard-coding the type 13:04
jnthn Which I guess is how it's compiling now 13:04
SmokeMachine so, some day this will just work? usercontent.irccloud-cdn.com/file/.../image.png 13:06
jnthn The --> T at least 13:07
The tuple one was discussed on a problem-solving issue and I kinda agreed with it too 13:08
lizmat SmokeMachine: why the ::?CLASS:U: case for WHICH, looks to me that is Mu::WHICH ?
afk&
SmokeMachine lizmat: good question
I just saw I've even 👍ed 13:10
(sorry, `I had`) 13:12
I was trying to find a easier way of using it then `($stack, my $ret) = $stack.pop`... 13:14
I was thinking on something like this... does this make any sense? www.irccloud.com/pastebin/7gqvxCRV/ 13:15
SmokeMachine but my first idea was to try to modify the `.=` op to make `my $val = $stack.=pop` get the first value and set $stack with it and return the rest... 13:17
is it possible to create an operator that would behave like that? (not necessarily the `.=`) 13:19
but I think `.=` would be perfect for that
vrurg SmokeMachine: should work if you define the lhs as 'is rw' 13:20
SmokeMachine vrurg: lhs?
vrurg SmokeMachine: left hand side 13:21
SmokeMachine the $stack? 13:22
vrurg SmokeMachine: yes. 13:23
m: multi infix:«<-»($a is raw, @b) { $a = @b.head; @b[1..*] }; my $s; say $s <- (1,2,3); say $s; 13:24
camelia (2 3)
1
vrurg m: multi infix:«<-»($a is rw, @b) { $a = @b.head; @b[1..*] }; my $s; say $s <- (1,2,3); say $s;
camelia (2 3)
1
vrurg is rw is better because it would check if lhs is a Scalar. 13:25
SmokeMachine but how to do that calling the method? 13:26
vrurg m: multi infix:«<-»($a is rw, @b) { $a = @b.head; @b[1..*] }; my $s; say 12 <- (1,2,3); say $s;
camelia Cannot resolve caller infix:«<-»(Int:D, List:D); the following candidates
match the type but require mutable arguments:
($a is rw, @b)
in block <unit> at <tmp> line 1
vrurg m: multi infix:«<-»($a is raw, @b) { $a = @b.pop; @b }; my $s; say $s <- [1,2,3]; say $s; 13:27
camelia [1 2]
3
vrurg SmokeMachine: ^^
SmokeMachine I mean the op receive the name of the method... 13:39
SmokeMachine I mean, if you do `$stask.pop` you'll receive the new stack and the poped value, but if you do `$stack.=pop` you only receive the poped value and $stack is changed to the new stack 13:43
vrurg SmokeMachine: I'm afraid you'd either have to expect a string on rhs or wait for RakuAST.
SmokeMachine I was thinking on a Slang 13:43
vrurg SmokeMachine: feels like you're gonna waste time on it. What's the use case? 13:48
SmokeMachine study...
vrurg: I'm studying functional data structures, and wonder is would be a easier way of using it 13:49
vrurg SmokeMachine: a method name in a string would spare you a lot of time, to my view. 13:51
Unless you'd like to study Raku grammar/action from inside out too.
SmokeMachine vrurg: that's one of my intents 13:55
vrurg Ok then. :) 13:56
Have fun then. Grammar/Action/World trio is a tricky place. 13:57
cpan-raku New module released to CPAN! Log (0.1.1) by 03TYIL 14:09
fluca1978 hi, I'm a little lost, what if I want to initialize a list with all True values like my @chessboard = True xx $dimension, True xx $dimension, True xx $dimension; and then have it mutable? 14:11
tellable6 2020-02-08T12:13:54Z #moarvm <rba> fluca1978: pl6anet.org feeds are configured in github.com/perl6/pl6anet.org/blob/...perlanetrc , so commit or PR
jnthn fluca1978: Try something like my @chessboard = [True xx $dimension] xx $dimension 14:12
timotimo m: my @board = [True xx 4] xx 4; say @board; @board <<=>> (Bool.pick xx *); say @board
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing << or >>
at <tmp>:1
------> 3True xx 4] xx 4; say @board; @board <<=>7⏏5> (Bool.pick xx *); say @board
expecting any of:
infix
infix stopper
timotimo m: my @board = [True xx 4] xx 4; say @board; @board <<[=]>> (Bool.pick xx *); say @board
camelia [[True True True True] [True True True True] [True True True True] [True True True True]]
List on right side of hyperop of infix:<=> is known to be infinite
in block <unit> at <tmp> line 1
timotimo m: my @board = [True xx 4] xx 4; say @board; @board <<[=]<< (Bool.pick xx *); say @board
camelia [[True True True True] [True True True True] [True True True True] [True True True True]]
List on right side of hyperop of infix:<=> is known to be infinite
in block <unit> at <tmp> line 1
timotimo m)
fluca1978 uhm... my @chessboard = [ True xx $dimension ] xx $dimension; still give me Cannot modify an immutable Bool (True) when trying to modify a single element 14:15
jnthn m: my $dimension = 4; my @chessboard = [ True xx $dimension ] xx $dimension; @chessboard[1][1] = False; say @chessboard; 14:17
camelia [[True True True True] [True False True True] [True True True True] [True True True True]]
fluca1978 my @chessboard = [ True xx $dimension ] xx $dimension; 14:20
@chessboard[ 0 ][ 0 ][ 0 ] = "Q";
with $dimension = 3
not working, maybe "This is Rakudo version 2020.01 built on MoarVM version 2020.01.1" ? 14:21
jnthn Oh, that meaning of dimension...
timotimo ohhh
Xliff m: my $dimension = 3; my @chessboard = [ True xx $dimension ] xx $dimension; @chessboard[0][0] = 'Q'; @chessboard.gist.say 14:22
camelia [[Q True True] [True True True] [True True True]]
jnthn You...want a 3D chess board? :)
Xliff fluca1978: You then need to choose a side. 14:22
s/side/size/
fluca1978 well, an n-dimension chessboard...
timotimo m: my $size = 3; my @dim = 5; my @chessboard; @chessboard[||($size xx @dim)] = 1; @chessboard >>[=]>> 1; say @chessboard
camelia [1 1 1 1]
timotimo hm, = isn't nodal? 14:23
m: my $size = 3; my @dim = 5; my @chessboard; @chessboard[||($size xx @dim)] = 1; @chessboard.duckmap(-> Any:U $v is rw { $v = 9 }); say @chessboard
camelia [9 9 9 1]
timotimo m: my $size = 3; my @dim = 5; my @chessboard; @chessboard[||([$size] xx @dim)] = 1; @chessboard.duckmap(-> Any:U $v is rw { $v = 9 }); say @chessboard 14:24
camelia [9 9 9 1]
timotimo m: my $size = 3; my @dim = 5; my @chessboard; @chessboard[||([$size,] xx @dim)] = 1; @chessboard.duckmap(-> Any:U $v is rw { $v = 9 }); say @chessboard
camelia [9 9 9 1]
timotimo how did i do the thing with interpolating a list-of-lists in a postcircumfix:<[ ]>
Xliff m: my $size = 3; my $dim = 2; my @chessboard; for ^$dim { my $r = True xx $dim; $r xx $_ for ^($dim-1); @chessboard[$_] = $r; }; @chessboard.say; 14:26
camelia WARNINGS for <tmp>:
[(True True) (True True)]
Useless use of $r in sink context (line 1)
Xliff m: my $size = 3; my $dim = 2; my @chessboard; for ^$dim { my $r = True xx $dim; $r = $r xx $_ for ^($dim-1); @chessboard[$_] = $r; }; @chessboard.say;
camelia [() ()]
Xliff m: my $size = 3; my $dim = 2; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $ for ^($dim-1); @chessboard[$_] = $r; }; @chessboard.say; 14:27
camelia Cannot resolve caller infix:<xx>(Code:D, Any:U); none of these signatures match:
()
(Mu \x)
(&x, Num:D(Any):D $n)
(&x, Whatever)
(&x, Bool:D $b)
(&x, Int:D $n)
(Mu \x, Num:D(Any):D $n)
(Mu \x, Whatever)…
Xliff m: my $size = 3; my $dim = 2; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $_ for ^($dim-1); @chessboard[$_] = $r; }; @chessboard.say;
camelia [() ()]
Xliff m: my $size = 3; my $dim = 2; my @chessboard; for ^$dim { my $r = True xx $size; @chessboard[$_] = $r; }; @chessboard.say; 14:28
camelia [(True True True) (True True True)]
Xliff m: my $size = 3; my $dim = 2; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $_ for ^($dim-2); @chessboard[$_] = $r; }; @chessboard.say;
camelia [(True True True) (True True True)]
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $_ for ^($dim-2); @chessboard[$_] = $r; }; @chessboard.say;
camelia [() () ()]
elcaro for 3D chessboard, you would just further nest it: my @chessboard = [[True xx $dimension] xx $dimension] xx $dimension;
Xliff elcaro: The trick is to generalize that. 14:29
elcaro yeah
you could do it with a shaped array :D 14:30
m: my @c[2;2;2].map({ $_ = True }); say @c;
camelia [[[True True]
[True True]]
[[True True]
[True True]]]
elcaro tho i hear perf isn't great on shaped arrays atm
Xliff elcaro: Yes, but again.. how would you initialize that without needing to know the number of dimensions in advance? ;) 14:31
m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $dim for ^($dim); @chessboard[$_] = $r; }; @chessboard.say;
camelia [((((True True True) (True True True) (True True True)) ((True True True) (True True True) (True True True)) ((True True True) (True True True) (True True True))) (((True True True) (True True True) (True True True)) ((True True True) (True True True)…
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $dim for ^($dim); @chessboard[$_] = $r; }; @chessboard[0].elems.say 14:32
camelia 3
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $dim for ^($dim); @chessboard[$_] = $r; }; @chessboard[0][0].elems.say
camelia 3
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $dim for ^($dim); @chessboard[$_] = $r; }; @chessboard[0][0][0].elems.say
camelia 3
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $dim for ^($dim); @chessboard[$_] = $r; }; @chessboard[0][0][0][0].elems.say
camelia 3
elcaro Xliff: can use a variable in shaped array definition
m: my $d = 3; my @c[$d;$d;$d].map({ $_ = True }); @c[0;0;0] = False; say @c;
camelia [[[False True True]
[True True True]
[True True True]]
[[True True True]
[True True True]
[True True True]]
[[True True True]
[True True True]
[True True True]]]
Xliff elcaro: Ah! Excellent!\
But again... you are still locking the dimensions to 3.\ 14:33
elcaro using map to initialise slots feels a little dirty :)
Xliff Yeah, well..../
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $dim for ^($dim-1); @chessboard[$_] = $r; }; @chessboard[0][0][0][0].elems.say 14:33
camelia 1
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $dim for ^($dim-1); @chessboard[$_] = $r; }; @chessboard[0][0][0].elems.say 14:34
camelia 3
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $dim for ^($dim-1); @chessboard[$_] = $r; }; @chessboard[0][0].elems.say
camelia 3
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $dim for ^($dim-1); @chessboard[$_] = $r; }; @chessboard[0].elems.say
camelia 3
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $dim for ^($dim-1); @chessboard[$_] = $r; }; @chessboard[0].gist.say
camelia (((True True True) (True True True) (True True True)) ((True True True) (True True True) (True True True)) ((True True True) (True True True) (True True True)))
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = True xx $size; $r = $r xx $dim for ^($dim-1); @chessboard[$_] = $r; }; @chessboard[1][1][1] = 'Q'; @chessboard[0].gist.say
camelia Cannot modify an immutable List (((True True True) (T...)
in block <unit> at <tmp> line 1
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = [ True xx $size ]; $r = $r xx $dim for ^($dim-1); @chessboard[$_] = $r; }; @chessboard[1][1][1] = 'Q'; @chessboard[0].gist.say 14:35
camelia Cannot modify an immutable List (([True True True] [T...)
in block <unit> at <tmp> line 1
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = [ True xx $size ]; $r = [ $r xx $dim ] for ^($dim-1); @chessboard[$_] = $r; }; @chessboard[1][1][1] = 'Q'; @chessboard[0].gist.say 14:36
camelia [[[True True True] [True True True] [True True True]] [[True True True] [True True True] [True True True]] [[True True True] [True True True] [True True True]]]
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = [ True xx $size ]; $r = [ $r xx $dim ] for ^($dim-1); @chessboard[$_] = $r; }; @chessboard[1][1][1] = 'Q'; @chessboard.gist.say
camelia [[[[True True True] [True True True] [True True True]] [[True True True] [True True True] [True True True]] [[True True True] [True True True] [True True True]]] [[[True True True] Q [True True True]] [[True True True] Q [True True True]] [[True True …
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = [ True xx $size ]; $r = [ $r xx $dim ] for ^($dim-2); @chessboard[$_] = $r; }; @chessboard[1][1][1] = 'Q'; @chessboard.gist.say
camelia [[[True True True] [True True True] [True True True]] [[True Q True] [True Q True] [True Q True]] [[True True True] [True True True] [True True True]]]
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = [ True xx $size ]; $r = [ $r xx $dim ] for ^($dim-2); @chessboard[$_] = $r; }; @chessboard[1][1][1][0] = 'Q'; @chessboard.gist.say 14:37
camelia Cannot modify an immutable Bool (True)
in block <unit> at <tmp> line 1
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = [ True xx $size ]; $r = [ $r xx $dim ] for ^($dim-2); @chessboard[$_] = $r; }; @chessboard[1][1][1].gist.say; @chessboard.gist.say
camelia True
[[[True True True] [True True True] [True True True]] [[True True True] [True True True] [True True True]] [[True True True] [True True True] [True True True]]]
Xliff m: my $size = 3; my $dim = 3; my @chessboard; for ^$dim { my $r = [ True xx $size ]; $r = [ $r xx $dim ] for ^($dim-2); @chessboard[$_] = $r; }; @chessboard[1][1][1].gist.say;
camelia True
Xliff Well... FWIW, I think that's close. Enough camelia play for today. 14:38
elcaro Xliff: perhaps they wer looking for something as simple as numpy.zeros((3, 3, 3)) 14:46
shaped arrays is as close as we get... you can slip arrays to the initialiser which completely generalises it 14:47
m: my @d = 3, 3, 3; my @c[|@d].map({ $_ = True }); @c[0;0;0] = False; say @c
camelia [[[False True True]
[True True True]
[True True True]]
[[True True True]
[True True True]
[True True True]]
[[True True True]
[True True True]
[True True True]]]
elcaro m: my @d = 1, 2, 4, 3; my @c[|@d].map({ $_ = True }); @c[0;0;0] = False; say @c 14:48
camelia Cannot assign to a 4 dimension array with only 3 dimensions
in block <unit> at <tmp> line 1
elcaro hm 14:49
m: my @d = 2,2,2,2; my @c[|@d].map({ $_ = True }); @c[0;0;0;0] = False; say @c
camelia [[[[False True]
[True True]]
[[True True]
[True True]]]
[[[True True]
[True True]]
[[True True]
[True True]]]]
elcaro oh... i forgot to update my assignment to False in the example that failed 14:50
m: my @d = 1,2,3,4; my @c[|@d].map({ $_ = True }); @c[0;0;0;0] = False; say @c
camelia [[[[False True True True]
[True True True True]
[True True True True]]
[[True True True True]
[True True True True]
[True True True True]]]]
elcaro actually... i don't think the slip is needed 14:51
elcaro my @d = 2,2,2; say my @c[@d]; 14:52
evalable6 [[[(Any) (Any)]
[(Any) (Any)]]
[[(Any) (Any)]
[(Any) (Any)]]]
Xliff elcaro++! 14:55
So it goes a lil somethin' like this... hit it!
m: my $size = 3; my $dim = 2; my @c = $size xx $dim; my @chessboard[@c]; @chessboard.map({ $_ = True }); @chessboard[1;1] = 'Q'; @chessboard.say
camelia [[True True True]
[True Q True]
[True True True]]
Xliff m: my $size = 3; my $dim = 3; my @c = $size xx $dim; my @chessboard[@c]; @chessboard.map({ $_ = True }); @chessboard[1;1] = 'Q'; @chessboard.say 14:56
camelia Cannot assign to a 3 dimension array with only 2 dimensions
in block <unit> at <tmp> line 1
Xliff m: my $size = 3; my $dim = 3; my @c = $size xx $dim; my @chessboard[@c]; @chessboard.map({ $_ = True }); @chessboard[1;1;1] = 'Q'; @chessboard.say
camelia [[[True True True]
[True True True]
[True True True]]
[[True True True]
[True Q True]
[True True True]]
[[True True True]
[True True True]
[True True True]]]
Xliff \o/ 14:57
Geth doc: uzluisf++ created pull request #3429:
Minor rewording with few examples
15:03
Xliff So this example brings up the question of: When are shaped array partials going to be implemented?
Because it is one thing to create a multi-dimensional array. It's another thing to access it without knowing its dimensionality ahead of time. 15:04
elcaro I think the answer to that is "well volunteered" 15:05
:D
Xliff Yeah. I kinda figured that.
elcaro We are a small community around a very big language. I've learned to wait for things. 15:06
timotimo m: my $dims = 9; my @foo := Array[int].new(:shape(3 xx $dims)); say @foo
camelia [[[[[[[[[(int) (int) (int)]
[(int) (int) (int)]
[(int) (int) (int)]]
[[(int) (int) (int)]
[(int) (int) (int)]
[(int) (int) (int)]]
[[(int) (int) (int)]
[(int) (int) (int)]
[…
timotimo but shaped native arrays are not very fast last time i checked
melezhik .tell rba , please ping me when you are here, thanks 15:10
tellable6 melezhik, I'll pass your message to rba
Xliff m: my $size = 3; my $dim = 3; my @c = $size xx $dim; my @chessboard[@c]; @chessboard.map({ $_ = ++$ }); @chessboard[1;1;1] = 'Q'; @chessboard.say 15:17
camelia [[[1 2 3]
[4 5 6]
[7 8 9]]
[[10 11 12]
[13 Q 15]
[16 17 18]]
[[19 20 21]
[22 23 24]
[25 26 27]]]
RaycatWhoDat c: say "Hello" 16:10
committable6 RaycatWhoDat, Seems like you forgot to specify a revision (will use “v6.c” instead of “say”)
RaycatWhoDat, ¦v6.c (43 commits): «Hello␤» 16:11
RaycatWhoDat p6: say "Hello".substr(-1)
camelia Start argument to substr out of range. Is: -1, should be in 0..5; use *-1 if you want to index relative to the end
in block <unit> at <tmp> line 1
RaycatWhoDat So, this makes sense. But when you do this:
p6: say "Hello".substr(*-1)
camelia o
RaycatWhoDat Or maybe I'm mistaken. 16:12
timotimo hm?
RaycatWhoDat p6: say "Hello".substr(*-1) ~~ "o"
camelia True
RaycatWhoDat timotimo: I was running into a weird error while trying to do a comparison on a substring 16:13
Seems like I might be mistaken, though. Let me double-check.
timotimo m: say "Hello".substr(*-20)
camelia Start argument to substr out of range. Is: -15, should be in 0..5;
in block <unit> at <tmp> line 1
timotimo ^- i wonder if we can make this error message cleverer based on knowing it's a whatever star based calculation 16:14
RaycatWhoDat Yeah, I think the test suite is passing in an empty string
I could give it a fang. 16:17
Could you capture your initial thoughts on it in an issue? 16:18
timotimo oh, hmm
another thing we'd want to think about: what if someone does the dangerous™ thing and puts code with a side-effect in there 16:19
and we would re-evaluate it when coming up with the error message
timotimo hmmm 16:19
in general, do we have many cases where calling .message on an exception at different times will give different, potentially wrong, outputs? 16:20
RaycatWhoDat I dunno, man. I'm just a fan of the language. 16:21
Haha.
Maybe one day, I'll be able to tell you off the cuff.
timotimo i'm not sure anybody would be able to without going through the Exceptions file in core 16:22
ShimmerFairy m: say (-> $a {$a - 1}).WHAT; say (*-1).WHAT; 16:23
camelia (Block)
(WhateverCode)
ShimmerFairy I feel like you could just check the type of the code, no?
timotimo hmm. we can probably get the value we had passed into the code and the value that came out 16:25
for use in the error message
timotimo (without making performance suffer, hopefully!) 16:29
RaycatWhoDat Man, the regexes are doing my head in 16:29
Can't seem to make one that just checks the whole string for uppercase letters 16:30
RaycatWhoDat /^^ <upper> ** 2..* $$/ doesn't work like I thought 16:30
ShimmerFairy m: say "HELLO" ~~ /^ <:Upper>+ $/; say "WORLd" ~~ /^ <:Upper>+ $/; 16:31
camelia 「HELLO」
Nil
ShimmerFairy I don't think <upper> exists by default, but there is of course the unicode property
RaycatWhoDat What does the colon do? 16:32
ShimmerFairy It allows you to match based on some unicode property (it works like colon pair notation) 16:34
RaycatWhoDat Ah. Nice.
Now I just need it to capture more than the first word 16:35
ShimmerFairy m: say "a_b" ~~ /^ <alpha>+ $/; say "a_b" ~~ /^ <:Alpha>+ $/; # <alpha> by default includes an underscore because stuff you parse tends to treat it like a kind of letter
camelia 「a_b」
alpha => 「a」
alpha => 「_」
alpha => 「b」
Nil
RaycatWhoDat Apparently, you can't adverb on ~~?
ShimmerFairy If you need adverbs on / regex / that can't go inside the regex, you could use m:adv/ ... / 16:36
RaycatWhoDat That's what it's complaining on
p6: say "test" ~~ rx:g/<:Upper>+/
camelia 5===SORRY!5=== Error while compiling <tmp>
Adverb g not allowed on rx
at <tmp>:1
------> 3say "test" ~~ rx:g/<:Upper>+/7⏏5<EOL>
ShimmerFairy m: say "test" ~~ m:g/<:Upper>+/ 16:37
camelia ()
ShimmerFairy I don't know offhand why rx// isn't working there
RaycatWhoDat Oh, literally use the 'm'
ShimmerFairy IIUC, :global is a match option and so it gets passed to the match function, not attached to the regex itself. m:g/something/ is really just $_.match(/something/, :g) 16:41
whereas rx// just makes a Regex object. 16:42
RaycatWhoDat Ah, that makes sense.
melezhik Hi! rakudist now is available as rakudist.raku.org/ . I'd appreciate if someone could test it. - sparrowdo.wordpress.com/2020/05/25...g-started/ 16:45
tellable6 2020-05-24T22:29:28Z #raku-dev <vrurg> melezhik thanks! I overlooked a strange copy/paste issue.
melezhik thanks to rba and AlexDaniel` for the help with rakudist.raku.org/
vrurg you are welcome, now you can test it through rakudist ))) 16:46
RaycatWhoDat How would you make this more concise? 17:28
m:g/<:Upper> ** 2..*/ and not m:g/<:Lower>/
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/6uQ0fchb3r
Undeclared routines:
and used at line 1. Did you mean 'end', 'any', 'rand'?
g used at line 1
RaycatWhoDat TIL m does a thing in IRC 17:29
timotimo heh
well what do you want the regex to do exactly?
the first one requires two or more uppercase in a row, the other requires no lower case to be in the string 17:30
RaycatWhoDat Hmm. Is there a way to ensure the string can only have capital letters? 17:31
(and whitespace and punctuation)
sena_kun .uc eq $_?
m: say "FOO AND BAR".uc eq "FOO AND BAR"; 17:32
camelia True
sena_kun m: say "FOO AND BaR".uc eq "FOO AND BAR";
camelia True
sena_kun wait, not this one
timotimo need to compare to itself pre-uc
sena_kun m: my $a = "FOO AND BAr"; say $a eq $a.uc;
camelia False
timotimo not two literals that are different :D
sena_kun m: my $a = "FOO AND BAR"; say $a eq $a.uc;
camelia True
sena_kun timotimo, well, I was lazy to write out a variable. A bit too lazy for it to work. :P 17:33
timotimo :) 17:33
RaycatWhoDat Mm. Seems to fail on certain tests. 17:34
sena_kun RaycatWhoDat, like what ones?
RaycatWhoDat "1, 2, 3" does equal "1, 2, 3" but it would fail the tests for this particular exercise
sena_kun Why, it prohibits digits? 17:35
RaycatWhoDat No, it's looking for context. Specifically between talking, questioning, shouting, and shouting a question. 17:36
timotimo "are all letters uppercase?" is true for "1, 2, 3"
RaycatWhoDat Right. But it would fail the test. 17:37
timotimo m: my $a = "1, 2, 3"; say $a eq $a.uc 17:38
camelia True
RaycatWhoDat Not that test, heh.
exercism.io/tracks/raku/exercises/...19b6bb2cac
Click on the instructions tab.
timotimo is "!!!!!!!!!!!!!!!!!!!!!!!!" not a yell? :D 17:38
RaycatWhoDat According to the rules, that wouldn't be valid because there are no letters in there. 17:39
timotimo OK
RaycatWhoDat Yeah, arbitrary problems are weird but I'm still trying to get my sea legs with the language. 17:40
timotimo ah :) 17:45
colomon_ m: sub check($a) { $a eq “a” | “b” }; my $c = check(“b”); dd $c 19:19
camelia Junction $c = any(Bool::False, Bool::True)
SmokeMachine how can I access the Raku's hash function? 22:15
rir Hello wonderful people and bots that pass the test. I uninstall Timmerman's todo-viewer but am left with this file: rakudo/install/share/perl6/site/sources/BF065922962C238A6A7D3B5D8B10FD2625F9789F which is Marcel's lib/Gui.pm6. What's going on? 23:24
^zef