This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
05:34 saint- left 06:57 Oshawott joined 06:59 archenoth left 07:06 Kaiepi joined 08:00 archenoth joined 08:02 Oshawott left 08:37 Oshawott joined 08:39 archenoth left 09:09 jaguart joined 09:19 Oshawott left, Oshawott joined 11:13 Ssw joined 11:27 Ssw left 12:08 Kaipei joined 12:10 Kaiepi left 12:18 frost joined 12:38 frost left
South how would i create an array of whatever length filled with a single value? ruby has Array#* which does this, but raku handles smthn like `<111>*5` or `[111]*5` differently 13:13
Nemokosch `xx` is the operator you are looking for 13:15
m: dd 111 xx 5 13:16
if you assign a Sequence to an Array, it will be stored as expected 13:17
SmokeMachine m: dd 111 xx 5
camelia (111, 111, 111, 111, 111).Seq
Nemokosch Yes, this time around it worked 13:18
just not on your end 😛 13:19
in Raku, the general principle is that operands adapt to the operator, not vice versa. Of course you can overload the same known operators to handle new types - but generally you have no reason to, because you can define new operators 13:20
SmokeMachine does Camelia answers `m:` from discord bridge to discord bridge only?
South nice, i was getting a little irked i couldn’t find it anywhere in the docs but it’s just a little hard to navigate rn 13:21
Nemokosch Smokemachine: seems like that, but even that doesn't seem to work for the raku irc channel 13:23
I can imagine that. Apparently the keyword to remember is "repetition"; it's described as the "list repetition operator" 13:25
as opposed to `x` which is the "string repetition operator"
South yeah i went looking for it on the op page after you mentioned it
Nemokosch strings and lists are so distinct that strings wouldn't even take indexing...
which is a bit too much to my taste but welp, comb can help if it's really needed 13:26
South i don’t remember raku being this extensive when i last looked at it tbh, theres a lot going on when i look at examples 13:28
it could very well be because of how unique it is tho 13:29
Nemokosch It's a huge language really. Someone said lately that it might be bigger than C++ which I wouldn't say buuut... it should give you an idea
South i caught a glimpse of the scale just through the ops page for sure, even coming from J i was a little awe struck 13:31
Nemokosch hahaha, J
the asciified APL, right? xD
South i have a feeling this will be a little harder to learn than J tbh 13:32
yeah, it’s the successor
Nemokosch well you can use Raku as an operator freakshow, too
South that is the goal, yes 13:33
Nemokosch 🤣
South i’ve been aware of raku for quite a while now and it’s reputation, only just now mustering the grit to really try it out
Nemokosch with special regards to the metaoperators and the ability to define your own operators
with your preferred associativity and precedence, of course xD 13:34
South very nice
Nemokosch ```perl 13:35
#!/usr/bin/env raku
subset Digit of Int where *.chars == 1; 13:36
sub infix:<nN>(Digit() $a, Digit() $b) is assoc<chain> {
abs($a - $b) == 1
}
my $n = prompt 'Input: ';
say [nN] $n.comb;
```
tells whether all subsequent digits of a number differ by one or not
South huh, that’s pretty nifty 13:46
the subset line is really elegant 13:47
14:20 m_athias left 14:21 m_athias joined 14:49 saint- joined 14:50 saint- left, saint- joined 14:53 jgaz joined 15:20 jgaz left
gfldex m:``` 16:09
use MONKEY-TYPING;
augment class Str {
method AT-POS($idx){ self.comb[$idx] }
}
say "Hallo Nemokosch!"[6];
```
<@297037173541175296> ^^^ there you go
Nemokosch exactly... 16:17
16:40 jgaz joined
SmokeMachine m: multi postcircumfix:<[ ]>(Str $s, UInt $i) { substr $s, $i, 1 } say "blablabla"[3] 17:20
camelia ===SORRY!=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> ]>(Str $s, UInt $i) { substr $s, $i, 1 }⏏ say "blablabla"[3]
expecting any of:
infix
infi…
SmokeMachine m: multi postcircumfix:<[ ]>(Str $s, UInt $i) { substr $s, $i, 1 }; say "blablabla"[3] 17:21
camelia b
gfldex SmokeMachine: overloading postcircumfix:<[ ]> is almost never a good idea 17:30
m: multi postcircumfix:<[ ]>(Str $s, UInt $i) { substr $s, $i, 1 }; say "blablabla"[3..6]
camelia Index out of range. Is: 3, should be in 0..0
in block <unit> at <tmp> line 1
gfldex The build in candidates take care of quite a few types of arguments 17:31
gfldex m:``` 17:33
use MONKEY-TYPING;
augment class Str {
method AT-POS($idx){ dd $idx; self.comb[$idx] }
method elems { self.chars }
}
say "Hallo Nemokosch!"[6..9, *-1].flat.join;
```
Nemokosch I'm horrified 😂 17:38
gfldex <@297037173541175296> Yes, we do support Halloween as well. 17:42
Nemokosch now that we are at it 17:44
do you know anything about Exports.pm6 being special once upon a time?
or was the author of HTML::Tag simply forgetful 😅
gfldex No. The only 2 special files are META6.json and Build.pm6 . 17:45
Nemokosch this module was oldish, 2017, but I also started thinking that maybe it simply got left out of 17:46
META6.json by accident
21:01 jgaz left 21:13 guifa_ left 21:14 guifa joined 21:18 saint- left 23:12 jaguart left