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.
01:05 ACfromTX left 01:06 MasterDuke joined 01:11 hudo_ left 01:12 hudo_ joined, hudo_ left 01:14 hudo_ joined 05:41 kjp left 05:42 kjp joined 06:26 deadmarshal_ left 06:46 deadmarshal_ joined 07:25 Manifest0 joined 07:51 sivoais left 08:01 Salizer joined
Salizer Hi. I'm trying to use "sub MAIN()" to generate a CLI. I'm using the example from here docs.raku.org/language/create-cli. But when I don't give the arguments, I don't get a nice "Usage: hello.raku <name>". Instead I get "rindex search target requires a concrete string, but got null". Am I missing something? Just copied the example from the 08:04
site. Is it because it's running on Windows? On beforehand, thank you
08:12 halloy1480 joined 08:13 halloy1480 is now known as Halizer 08:15 dakkar joined
ab5tract I believe there is a known issue on windows /( 09:17
:( 09:18
Which version are you running?
Salizer v2024.04 09:30
ab5tract Ok, thanks. 09:35
Can you share what your MAIN looks like? 09:36
09:40 hudo_ left 09:41 hudo_ joined, hudo_ left, hudo_ joined, hudo_ left 09:43 hudo_ joined 09:44 hudo_ left 09:45 hudo_ joined 09:47 hudo joined, hudo_ left
ab5tract The signature I mean 09:53
10:01 Halizer left 10:02 Salizer left 10:11 MasterDuke left 10:50 Salizer joined
Salizer Just like the example from the URL (docs.raku.org/language/create-cli): sub MAIN($name) { say "Hello $name, how are you?"} 10:50
lizmat Salizer: what does: raku -e 'say $*VM' 10:55
show?
ab5tract github.com/rakudo/rakudo/issues/5445 10:57
lizmat ok, that shows that it is indeed on the MoarVM backend 10:59
ab5tract Salizer: we will get this fixed but in the meantime you might find using WSL a bit more comfortable, if possible
11:43 Salizer left
rcmlz @librasteve I liked you post about the common word test. Maybe this could be done for N-Grams, where Raku can shine even more (problably not by speed, but by features) bash #!/usr/bin/env raku use v6.e.PREVIEW; sub MAIN { # create-n-grams-minimal.raku < inputs/kjvbible.txt # 5 most common 3-Grams say $*IN.words.grep(*.chars >= 3)».comb(3 => -2).Bag.sort(-*.value).head(5) } 13:39
Maybe in the future the grep can go into the comb 13:42
13:55 halloy1480 joined
halloy1480 So I'm recommended to use WSL for Raku? 13:56
13:56 halloy1480 is now known as Salizer
Salizer How is the Windows support in general? I use Linux (Mint) at home, but for work (where I'll probably use it the most) I use Windows. 13:57
ab5tract At the moment, yes. Historically Windows builds have worked fine but it seems a few issues have temporarily seeped in.
Salazar: windows has generally had excellent parity. But indeed it seems a few small problems have emerged in the last two or so years. 13:58
There’s also stuff like 5ab5traction5.bearblog.dev/fixing-...s-windows/ 14:01
antononcube @rcmlz I use Markov chains on N-grams to explain / illustrate how LLMs work. 14:31
I genereate N-gramps using rotor and make an (ML) prefix tree with them: rakuforprediction.wordpress.com/20...eneration/ 14:33
rcmlz Ah, yes. „rotoring“ an array of letters would be also possible. The usecase I had in mind is more classical „make a search engine to search content of documents in a folder“ where one approach is to split text documents (strings) into words and then split each word into e.g. 3-grams and then work with these 3-grams for matching user queries and documents. By using comb from v6.e you do not need to split 14:48
the words first into an array for rotor. I assumed that is more performant - but did not test it.
14:58 Salizer left
halloy1480: according to my findings many modules from raku.land do not install under Windows. Similar to other programming languages - as soon as you step aside Linux prepare for extra work to get things installed. Maybe fork and run this with the modules you intend to use. github.com/rcmlz/Raku-Module-Health-Check 15:00
16:41 dakkar left
librasteve rcmlz: thanks, i’m still trying to get the tone right … and hoping that a few posts in HN will help get the word out and interest the curious 17:24
lizmat note that .comb has rotor-like capabilities in 6.e: docs.raku.org/routine/comb 17:32
since 2022.12
m: use v6.e.PREVIEW; .say for "hello world".comb(3 => -2) 17:33
camelia hel
ell
llo
lo
o w
wo
wor
orl
rld
lizmat m: use v6.e.PREVIEW; .say for "hello world".comb(3 => -2, :partial) 17:34
camelia hel
ell
llo
lo
o w
wo
wor
orl
rld
ld
d
Tirifto So today I was surprised by the fact that slurpy parameters are apparently always defined! (Not a complaint, just thought it worthy of mentioning.) 19:06
antononcube 🤔 I might ask ChatGPT to explain this to me... 19:12
@Tirifto I think I am using or rely on this in the package "LLM::Functions". 19:16
lizmat Tirifto: you mean %_ ? 19:35
Tirifto lizmat, in my case it was *@slurpy-parameter. 19:41
lizmat then what do you mean with "always defined" ?
Tirifto m: sub a(Int $a, *@b) { with @b { say “b is: ‘{@b.raku}’.” } else { say “No b defined.” } }; a(1, 2, 3); a(1); 19:44
camelia b is: ‘[2, 3]’.
b is: ‘[]’.
lizmat Tirifto: that goes for any Array object: 19:45
m: my @a; with @a { dd $_ }
camelia []
lizmat m: with [] { dd $_ }
camelia []
lizmat m: my @a; say @a.defined
camelia True
Tirifto Oh! So parameters in a signature behave much like ordinary variables with the same sigils then, right? 19:47
lizmat yes 19:54
for all intents and purposes, they *are* ordinary variables inside the block 19:55
with one notable exception: by default, $ sigilled parameters are a read-only container 19:56
unless you specify "is copy" on them
Tirifto Somehow that didn’t occur to me, but it makes sense now. Thank you! cx 19:58
23:34 hudo left 23:35 hudo joined