🦋 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.
00:01 kaiwulf joined 00:21 neshpion joined 00:40 mowcat left
tbrowder .ask vrurg please look at pr #4 at github.cm/Raku/planet.raku.org 00:49
tellable6 tbrowder, I'll pass your message to vrurg
00:57 pecastro left 00:59 lucasb left 01:00 gnufr33dom left
vrurg tbrowder: why me? What shall I check? 01:05
tellable6 2021-02-07T00:49:15Z #raku <tbrowder> vrurg please look at pr #4 at github.cm/Raku/planet.raku.org
01:12 eseyman left 01:14 eseyman joined 01:41 MasterDuke left 02:04 stoned75 left 02:10 kvw_5 joined 02:13 kvw_5_ left 02:31 guifa joined
tbrowder it looks like you were one of the last to make an entry. read the README and see if you can add any details for what your entry lines mean. thnx 02:48
02:51 gnufr33dom joined 02:54 JRaspass left 02:58 Garbanzo joined 03:58 coverable6 left, nativecallable6 left, committable6 left, statisfiable6 left, greppable6 left, benchable6 left, unicodable6 left, quotable6 left, squashable6 left, releasable6 left, shareable6 left, bisectable6 left, linkable6 left, bloatable6 left, evalable6 left, tellable6 left, sourceable6 left, notable6 left, evalable6 joined, benchable6 joined, statisfiable6 joined, shareable6 joined, coverable6 joined, notable6 joined 03:59 bloatable6 joined, quotable6 joined, tellable6 joined, linkable6 joined 04:00 releasable6 joined, greppable6 joined, committable6 joined, nativecallable6 joined, squashable6 joined, unicodable6 joined, bisectable6 joined 04:01 sourceable6 joined 05:01 quotable6 left, notable6 left, releasable6 left, greppable6 left, evalable6 left, bloatable6 left, linkable6 left, shareable6 left, unicodable6 left, statisfiable6 left, squashable6 left, benchable6 left, sourceable6 left, tellable6 left, committable6 left, coverable6 left, nativecallable6 left, bisectable6 left, evalable6 joined, bisectable6 joined, benchable6 joined, linkable6 joined, greppable6 joined, notable6 joined 05:02 committable6 joined, squashable6 joined, bloatable6 joined, coverable6 joined, unicodable6 joined, nativecallable6 joined, quotable6 joined 05:03 releasable6 joined, sourceable6 joined, tellable6 joined, shareable6 joined 05:04 statisfiable6 joined 05:08 kaiwulf left 05:14 simcop2387 left 05:15 rindolf joined 05:32 brtastic joined 05:37 neshpion left 05:47 [Sno] left 06:07 coldpress left 06:20 [Sno] joined 06:21 coldpress joined 06:24 [Sno] left 06:26 brtastic left 06:33 simcop2387 joined 06:46 simcop2387 left 06:52 simcop2387 joined, gnufr33dom left 06:54 gnufr33dom joined 07:38 jmerelo joined 07:44 parabolize left 08:03 simcop2387 left 08:04 Garbanzo left 08:05 aborazmeh joined 08:07 simcop2387 joined 08:17 gnufr33dom left 08:21 [Sno] joined 08:22 stoned75 joined 08:26 [Sno] left 08:30 wamba joined 08:39 aborazmeh left 08:51 simcop2387 left 09:03 db48x joined, simcop2387 joined 09:05 aborazmeh joined 09:13 aborazmeh left
krako[m] Mornin' everyone ! 09:18
09:26 kini left 09:27 kini joined 09:30 bonz060 joined
moritz hi there 09:34
09:37 MasterDuke joined
jmerelo hi! 09:41
Finished my talk @fosdem, jj.github.io/raku-patterns
09:42 aborazmeh joined
krako[m] jmerelo: cool, thanks for the link ! 09:49
jmerelo Sure :-)
krako[m] jmerelo this talk ? "Let me tell you about Raku On why syntax is not so important, with an introduction to the emerging language Raku" 09:59
09:59 aborazmeh left
jmerelo krako[m]:that's the one I gave last year in the same devroom 09:59
krako[m]: that one is here jj.github.io/hablando-p6/fosdem20.html#/ The Fosdem video has also been published, I can dig it up if you want. 10:00
db48x what do folks usually use for debugging regexes and grammars? 10:12
krako[m] I tend to use regex101.com for regexes but I'm just learning Raku since yesterday so I don't know how to test grammars. 10:16
jmerelo: I don't want to be annoying but I don't find the talk video related to jj.github.io/raku-patterns... 10:17
Could you put the link here, please ?
10:18 kini left 10:22 [Sno] joined, kini joined 10:24 brtastic joined
CIAvash db48x: I haven't used it, but probably github.com/jnthn/grammar-debugger 10:27
krako[m] This slide is gold : "But I knew the concepts Because I code in Raku" (from jj.github.io/hablando-p6/fosdem20.html#/13/2) 10:29
db48x CIAvash: I've tried it briefly 10:35
sadly it only tells you what the named regexes are doing
but it has helped
jmerelo krako[m]: it's gold because it's true :-) 10:37
krako[m]: that is this year's talk, it's not been published yet...
db48x also, the ideal tool would show you what part of the input a failed regex was trying to match against 10:38
jmerelo Just to be clear. This year: "Raku patterns", no video. Last year: "let me tell you about Raku", link above, video here www.youtube.com/watch?v=7Ivoh-fzDw8&t=150s
krako[m]: you can use Comma to debug grammars. It works pretty well. 10:43
krako[m] As I'm new to Raku(/pPerl), I didn't tried Comma yet. (I mainly use neovim or emacs) 10:44
10:45 aluaces left, aluaces joined
krako[m] <jmerelo "Just to be clear. This year: "Ra"> Ok understood ! Thanks ! 10:46
10:59 Sgeo left
jmerelo krako[m]: sure :-) 10:59
11:03 brtastic left 11:11 wamba left 11:12 wamba joined
krako[m] I've just installed the Comma Community IDE and created a new script project. 11:22
In the script file, I see this shebang `#!/usr/bin/env perl6` and as the `perl6` and `raku` executables are the same, I'm wondering wich one is preferred or generally advised ?
lizmat if your version supports "raku", then "raku" is the best choice moving forward 11:24
the "perl6" is just to support older versions (pre 2019.11)
and that will be removed at some point in the fuyure 11:25
krako[m] Actually, I have the same kind of questions for the scripts file extension, is this better to use `*.pl6`, `*.p6` or `*.raku` ?
ok, thanks lizmat !
lizmat use the new extensions if you can be sure that your deployment situations allows using them
e.g. all of my modules in the ecosystem still use .pm6 as I want to be sure they can be used in Raku versions before the 2019.11 release 11:26
krako[m] I check if there is a way to change the default shebang in `Comma`. 11:31
I'm just starting to use and learn Raku so it might not be a problem with "deployment situations". Right ?! 11:32
*`I check` --> `I'll check`
11:34 mahafyi joined
lizmat krako[m]: right :-) 11:46
12:19 QhpAptyj9hj0RQwM left 12:21 kini left 12:22 kini joined 12:33 pecastro joined 12:40 MasterDuke left, mahafyi left 13:07 mahafyi joined
db48x I'm confused 13:13
lizmat This is the Raku IRC channel 13:14
db48x I have a regex that is supposed to match everything up to the end of the line, using $$
works great on a short string, where the end of the line is also the end of the string 13:15
but as soon as I have two lines, it doesn't work
lizmat can you create a gist ? 13:16
db48x pastebin.com/6gc6UdX2 13:18
lizmat feels to me the .* is too greedy? 13:20
hmmm 13:22
db48x could be
lizmat so what is your expectation ?
db48x could be 13:23
I just want to grab everything up to the end of the line
lizmat that's what your example does for me
db48x but only on test1
lizmat which version of raku are you using ?
db48x 2019.03.1 13:24
lizmat ah, ok, I see what you're saying
I'm sorry, I appear to draw a blank 13:28
maybe moritz will be able to help 13:29
db48x if .* is too greedy, then \N* seems like it ought to work
same result though
masak I can't easily see the pastebin, but -- as a general rule, `.*` is almost never the right answer :) 13:38
m: say "abc\ndef\n" ~~ / \N* $$ / 13:39
evalable6 「abc」
masak m: say "abc\ndef\n" ~~ m:2nd/ \N* $$ /
evalable6 「」
moritz \N* should be enough 13:40
masak um. I might be rusty on the syntax.
moritz possibly followed by \n? if you want to gobble up the trailing newline as well
CIAvash `say $test2 ~~ /[^^ '='+ .* $$]+/;` works
masak m: say "abc\ndef\n" ~~ rx:2nd/ \N* $$ /
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/jD24Ks8AcS
Adverb nd not allowed on rx
at /tmp/jD24Ks8AcS:1
------> 03say "abc\ndef\n" ~~ rx:2nd/ \N* $$ /08⏏04<EOL>
moritz masak: no, it's just that the first match of \N* $$ matches the first line
and the second match of it matches the empty string before the first newline
masak ah, of course 13:41
the Curse of the Zero-Width Match
m: say "abc\ndef\n" ~~ m:2nd/ \N* \n? / 13:42
evalable6 「def
moritz m: .say for "abc\ndef\n".match: :g, /\N* \n?/
evalable6 「abc


masak there ya go :D
moritz: we're not as much in sync as we used to be :P
moritz m: .say for "abc\ndef\n".match: :g, /\N* )> \n?/
evalable6 「abc」
13:42 leont joined
moritz masak: I blame your reduced activity here... though mine has dropped as well 13:42
lizmat it's not too late to come back :-) 13:43
db48x ok, changing the $$ to \n? does "fix" it 13:44
masak moritz: that's fair
CIAvash but why does it work as a simple regex match?
masak db48x: the essential bit is that $$ matches an end-of-line, but consumes nothing
moritz: I'm still thinking about extensible parsers, by the way. it's a tough nut to crack. 13:47
moritz: today I thought, maybe if in the derived grammar you're forced to re-state the rule you're overriding, that would help fix the "fragile base grammar problem" 13:49
13:49 lichtkind joined
masak but I'm not sure of the ergonomics of that 13:50
CIAvash m: say "abc\ndef\n" ~~ /[^^ .* $$]+/
evalable6 「abc
masak CIAvash: there's the issue with .*
CIAvash: which I stated above, mind, is almost never the solution
CIAvash the same regex doesn't work in a grammar 13:51
masak m: grammar G { regex TOP { ^^ .* $$ } }; say G.parse("abc\ndef\n") 13:52
evalable6 Nil
CIAvash yeah, .* is eating everything
masak hm. at first blush, so it seems
m: grammar G { regex TOP { ^^ .* $$ } }; say G.parse("abc\ndef") 13:54
evalable6 「abc
masak on top of what a regex matches, a grammar also wants to match end-of-string 13:55
that's why
CIAvash masak++
masak haven't had an increment in ages :D 13:56
tadzik .karma masak 13:57
stoned75 ~.
13:57 stoned75 left
masak tadzik: the big IRC server in the sky can track the karma :P 13:57
El_Che For people thinking wat niche Raku can fill: www.oreilly.com/radar/where-progra...d-in-2021/ 13:58
tadzik masak: we could solve it with a blockchain ;)
masak tadzik: this does not even dignify a response 14:00
moritz and yet, you gave one, masak :D 14:05
14:05 MasterDuke joined
leont forgot about codesections' presentation, hopes it will be uploaded soon 14:09
(it sounded like it would have a lot of overlap with his Zen of Raku blogposts, which I rather liked)
Ah, found the slides :-) 14:16
14:18 brtastic joined 14:21 wamba left
db48x rubs his eyes 14:26
now that I'm successfully matching up to the end of the line and consuming those newlines, my grammar goes into an infinite loop at the end of the string
14:27 patrickb joined 14:31 kaiwulf joined
moritz that likely means that you have quantified somthing that matches zero characters 14:35
andinus how would i match : either a space or end of sentence with regex? 14:38
i have "\n\ntest \n\na* b c d\ne f g h" and i'm using / \n\n [(\w \*?) \s*?]+ / 14:39
and i want <a* b c d>, <e f g h>
removing the *? from \s works (oh that * is an error, i just meant to place '?') 14:40
^ but that matches "test""
m: "\n\ntest \n\na* b c d\ne f g h" ~~ / \n\n [(\w \*?) \s?]+ /
andinus m: "\n\ntest \n\na* b c d\ne f g h" ~~ / \n\n [(\w \*?) \s]+ / 14:41
andinus hmm, i'll just paste the actual data
m: my $desc = "Test\n\nHint\n\nA R C E\nN E D L\nI* J* A I" ;say $desc ~~ / \n\n [(\w \*?) \s]+ /; 14:43

I* J* A 」
0 => 「A」
0 => 「R」
0 => 「C」
0 => 「E」
0 => 「N」
0 => 「E」
0 => 「D」
0 => 「L」
0 => 「I*」
0 => 「J*」
0 => 「A」
andinus there ^, it doesn't match the last "I" though, i also want that
hmm nvm i figured it, [\s|$] works fine 14:45
14:46 kini left 14:47 kini joined
andinus so i ended up with this: / \n\n ([(\w \*?) [\s|$]]+ [\n|$])+ / 14:53
but it's not able to seperate those strings in different lists, it gives me a single flat list of chars
hmm if something causes raku to allocate memory endlessly then is it a bug? 15:10
15:14 mowcat joined 15:19 gnufr33dom joined 15:23 wamba joined
andinus i ended up with this: / \n\n ( [(\w \*?) \s?] ** 4 [\n|$] )+ / 15:23
^ it works but i've hardcoded "4" in there
instead of "\s?" i want something like: either \s or \n, if it's \n then add this to next array 15:25
guifa “hmm if something causes raku to allocate memory endlessly then is it a bug?” Not necessary. while (1) { Foo *foo = malloc(sizeof(Foo)) } (or whatever the exact syntax is, been a while since I’ve done C) is not a bug in C, but will cause endless allocation 15:28
andinus i had a regex that caused that, does it apply then? 15:29
guifa I’m still trying to grok what your goal is, are you wanting to get ARCE in one list, NEDL in another, and I*J*AI in another?
andinus guifa: yes, right
guifa You don’t have anything delimiting the three groups in your regex
andinus i see, i'm not sure what delimiting is 15:31
guifa something that separates things
andinus like () []?
guifa Your regex delimits the letters using a space 15:32
andinus oh and those groups must be delimited by \n
hmm, i'm not sure how i would achieve that 15:33
guifa Try to build regex up from the smallest element and go up from there 15:34
andinus / \n\n [ ( [(\w \*?) \s?]+ ) \n ]+ / <-- \n should act like a delimiter in this right? 15:35
guifa: i see, thanks
i havent read much on it, i'll read up first
guifa Smallest element here is the letter. Lots of ways to represent it, but I’d go with \S+
The next smallest is the group of letters
Which is what you just got with spaces in between it 15:36
so you get (\S+)+ % \h
Next you want to grab individual lines with that pattern in it so
( (\S+)+ % \h )+ \n 15:37
15:37 jmerelo left
guifa And lastly, you want to start the pattern after a double return 15:37
\n \n ( (\S+)+ % \h )+ \n
err sorry missing a % 15:39
\n \n ( (\S+)+ % \h )+ % \n
15:40 parabolize joined, coldpress left
guifa The only problem here is that this technically does match Hint. So to limit things more, you can either be stricter about the inner bit (using \S \*? instead of \S+), explicitly putting “Hint\n\n” in the regex start, or requiring more than one inner match (\S+) ** 2..* % \h 15:41
andinus i see, thanks for the explaination 15:42
yeah i added \*?
this is also capturing the whole thing in a single array 15:43
m: "\n\ntest \n\na* b c d\ne f g h" ~~ / \n\n ( (\S \*?)+ % \s? ) ** 2..* % \n $ /;
andinus m: "\n\ntest \n\na* b c d\ne f g h" ~~ / \n\n ( (\S \*?)+ % \h ) ** 2..* % \n $ /; 15:44
andinus hmm yeah this was the wrong $desc, i'll paste the correct one
my $desc = "Test\n\nHint\n\nA R C E\nN E D L\nI* J* A I" ;say $desc ~~ / \n\n ((\S \*?)+ % \h ) ** 2..* % \n $ /; 15:45

I* J* A I」
0 => 「A R …
andinus, Full output: gist.github.com/f1f1827fae91125777...befdd71cd8
andinus oh wait 15:46
this works
hmm i hadn't changed that \s to \h locally 15:47
guifa But you might consider breaking things out into tokens
andinus guifa: makes sense, thanks 15:49
it was easy to understand and read maybe i just dont put much thought when writing it 15:50
guifa I think a lot of times people try to write regex left to right, when they need to make it small to big 15:54
That’s part of the reason you have the grammars in Raku — it really pushes you to think of things that way
andinus i see, yeah it was easier when going small to big 15:58
how much of a difference should 1.5GHz vs 2.5GHz bring for rakudo? 16:03
i ran a thing on both systems and the difference was ~10x -- calculating factorial of a large number 16:04
by difference i mean the time taken
db48x andinus: it depends on the program you're running 16:05
guifa Also if you’re just teseting a single number, there’s a lot of other factors that throw things off by that much. (that’s why most performance tests will run things many times, often in the thousands for microbenchmarks like that)
andinus yeah i tried it ~4-5 times and the results were consistent 16:06
db48x there are also other factors besides clock frequency to consider, such as IPC
cache sizes 16:07
andinus i also tried calculations for calculating e (euler's constant) -- from the blogpost on perl.org
db48x memory bandwidth
andinus hmm i see
db48x also the specific features that are enabled in the two cpus 16:08
andinus ^ those calculations for e pulished their timings, mine were 10x slow, i ran it on a 2.5GHz machine and they were at par with post's speed
16:09 notagoodidea joined
andinus i see, ah it might be that, both are on different oses 16:09
i'm running openbsd which disables SMT and maybe other thigns too that i don't know about
db48x the OS can also have a big effect, especially on some types of benchmarks 16:10
notagoodidea Is there somewhere to file an issue for Comma?
tellable6 2021-01-29T00:26:11Z #raku <guifa2> notagoodidea RakuAST will let me create compiled-ish code without using EVAL, and interact much better with existing pblocks, etc,
andinus i see, i remember trying with SMT enabled but that didn't have much of an effect
^ this was the post i was talking about
db48x you also have to consider how much cooling is available, and how the motherboard shapes the power delivered to the cpu 16:11
andinus notagoodidea: i see only [email@hidden.address] given on their page 16:14
db48x: i see, i'll tyr looking those up
notagoodidea Yep found that too, mail sent, will see :) (it's a minor issue so)
16:18 neshpion joined
andinus most of the time is spend on compiling the module after i change it 16:20
so this thing takes 44s without precomp, and 20s with precomp, so i guess 20s is taken for compiling it 16:21
the code is not really huge, <70 lines
guifa That feels very strange. 70 lines should compile very quickly 16:25
I have modules with tens of thousands of lines of code and they fresh compile in <10
lucs Um, who manages the colabti.org irclogger bot? 16:26
16:31 stoned75 joined 16:33 mahafyi left, MasterDuke left, MasterDuke joined
MasterDuke defining new operators can slow down parsing *considerably* 16:33
lucs: i think AlexDaniel` mentioned a name recently 16:34
16:35 aborazmeh joined
lucs I'm thinking it's Moritz, but my memory is crap. 16:36
16:36 ab5tract joined
lucs Oh, I know, I'll search the logs :) 16:37
16:40 ab5tract left
MasterDuke moritz ran the old logger, but not colabti 16:40
lucs: "AlexDaniel`     if you see any issues, let feb know on #irclogger" 16:41
lucs Aha, thanks MasterDuke
MasterDuke np 16:42
guifa MasterDuke: it shouldn’t slow somethign down that much for just 70 lines though 16:44
16:46 xelxebar left, xelxebar joined
MasterDuke that does seem a bit excessive, but github.com/Raku/old-issue-tracker/issues/4429 and github.com/Raku/old-issue-tracker/issues/5496 have some examples of the kind of slowdown i mean 16:53
16:54 [Coke] left 16:55 jmerelo joined 16:59 aborazmeh left 17:03 aborazmeh joined 17:05 domidumont joined
lizmat Introducing the Raku Collect, Conserve and Remaster Project: www.reddit.com/r/rakulang/comments...serve_and/ 17:08
andinus yes it really is too slow for everything i do on here, 17:10
hmm actually this is not the normal state, `time raku -e ""` says 2s, usually it says 1s 17:11
ok its down to 0.9s now, i ran the precomp code right after this and it took 12s 17:12
and without precomp it took 30s 17:13
MasterDuke: i'm not defining any new operator, it's just bunch of string parsing 17:14
github.com/andinus/octans/blob/mas...le.rakumod 17:16
^ there is the code that i'm changing
it's not fetching the web, i'm testing the local file part 17:17
perry lizmat, that is /awesome/. The sort of "code rot" in rapidly developing programming languages has always been a real pain.
andinus when i run it after adding a new line in between it takes ~40s, after comp is done, it takes ~12s to run with precomp 17:18
notagoodidea lizmat: This great! Does pushing the blogpost to archive.org for conservation is an option also?
lizmat well, not initially I would think 17:19
I can see archive.org being a *source* of blog posts lost in the mists of time
17:26 natrys joined 17:28 aborazmeh left
notagoodidea I understand why. I was thinking with the collect script that is just a call away to push the page to archive.org with `curl web.archive.org/save/{URL}`, it just act as a double back-up. 17:31
MasterDuke andinus: you must be on some slow hardware. `time raku -e ''` is 0.1s for me 17:39
notagoodidea 462 millis (i5/8Go) 17:40
El_Che real0m0,146s user0m0,146s sys0m0,024s 17:42
andinus hmm yeah this is the 1.5GHz thing i was talking about,
but raku particularly runs slower, perl even with loading modules like DateTime take less than 0.2s 17:43
and simply perl -e "" takes 0.04s 17:44
guifa If you run Perl with one of the OO modules, the start up time is roughly the same, though. 17:48
andinus like Moose? 17:51
notagoodidea yep
andinus i see, i'll try that
17:53 kensanata joined
andinus you were right, it takes 0.8 real 17:53
0m00.76s real 0m00.57s user 0m00.14s system
^ perl with use Moose
0m00.89s real 0m00.63s user 0m00.25s system
^ raku
guifa Basically, Raku includes a lot of the stuff that Perl woul dneed imported in, though at a small cost to start up time 17:55
andinus i see, makes sense 17:56
18:13 kensanata left
jmerelo Just a reminder we're still looking for ideas for the Google Summer of Code perl-foundation-outreach.github.io...021-ideas/ 18:45
perry "Fix typos in one line comments"? (Sorry, couldn't help myself.) 18:46
jmerelo I'm looking for something, not totally sure if it exists or not (probably not): A markdown parser that captures document structure. That is, instead of separated or embedded tags, it would put the text after a heading as part of the heading, and so on. 18:54
What I'm looking for is a way of indexing text in markdown so that I can return the anchor to the closest header. 18:55
El_Che hi jmerelo: how were the 2 talks? I wasn't at home, so I'll watch the recoring 19:02
recording 19:03
jmerelo El_Che: lightning talks? The first one about Perl left people a bit cold, the second one about CI/CD did elicit some reaction.
El_Che:the first one about Raku, mostly OK. Hope to raise some awareness and/or enthusiasm outside. 19:04
El_Che ClassOps :)
jmerelo Yep, ClassOps was the one... Initially all written in Perl, now there are parts in TypeScript and all. 19:07
19:08 kaiwulf left
guifa jmerelo: shouldn’t be too hard to make. 19:08
jmerelo guifa: yep, but I'm afraid to start the yak shaving. I might end up with a full-tex-indexing-multi-threaded framework that serves questions via XMPP. Or nothing. 19:13
19:13 domidumont left
guifa Ha 19:13
El_Che or a new JS web framework
jmerelo guifa: final intention is to create a Telegram bot that the students can use to query class material. As in /whereis REST API and get back a list of links to class material that talks about it. 19:14
guifa has thought there might be some utility in maintaining a set of modules that do just structured document parsing with grammars, specifically designed with the idea of folks creating custom actions
jmerelo Closest subsection header, that is.
guifa: that wouldn't be a bad idea. 19:15
guifa I was thinking it because the other day a friend sent me some subtitles for a documentary they did and I couldn’t find anything to open it up 19:21
Was some weird Euro format haha
jmerelo May I interest you in sending some stuff to this conference? extra.codemotion.com/onlineconfspa...-2021-cfp/ We should try and spread the word abour Raku 19:25
19:26 aborazmeh joined 19:27 aborazmeh left
El_Che "We are looking forward to proposals related to the following topics: @hip_stuff" 19:30
guifa Hmm, I dunno what to talk about, but if I can figure out a topic happy to do it. 19:31
Although April does smash right into when I’ve got to give finals lol 19:32
From the Spanish version of the page: “Conviértete en speaker” — jmerelo should I trust a conference that doesn’t know Spanish? ;-) 19:33
krako[m] Reading the first output of raku.guide/#_functions_and_mutators, I see the array printed with `[ ]` but when using `say @numbers.sort;`, the array is printed with `( )`. 19:42
Why is there this difference in outputs ?
19:42 stoned75 left, stoned75_ joined
guifa krako[m]: sort produces a Seq 19:45
for the fourth example there where it’s reassigned, the Seq is consumed by assignment
and is now an Array
krako[m] oh ok ! I guess I have to read further to know the diffs between array and sequence... 19:46
Thanks guifa !
guifa (that’s not 1000% how it works in the background, but I think should make enough sense)
A seq isn’t really stored in memory — it’s Iterable, but not Positional 19:48
Imagine you have a 1000000 item array and you want to call something like reverse on it 19:49
One way is to create a new array, copying all of the values over, but that requires allocating all of that memory
But if you’re doing for @foo.reverse { … }, that’s a waste: we only ever need one value at a time 19:50
A Seq just provides a new value when needed (so in memory you might only store a position and a reference to the original array) 19:51
But it’s one directional, you can’t scan backwards because the efficiency means it’ll have forgotten old values 19:52
krako[m] quite like `range()` in Python. `range(1_000_000_000)` won't create the list with all elementes once but only "on demand" (e.g. for iteration) 19:53
jmerelo guifa: who knows... 19:55
krako[m] (sorry if Python is not liked here but that's the main language I use)
jmerelo krako[m]: we love _all_ languages, bar none. Which is why we use Raku :-) 19:56
notagoodidea jmerelo: Do you have an idea where the ClassOp talks may be uploaded to the Fosdem archives or if it is available somewhere? (I was not available to look at it but it touch something I worked a bit on when I was a TA)
19:56 jmerelo left
notagoodidea That's... an answer :D 19:57
krako[m]: If I do not say something really wrong, you can think of it a bit like a generator in python, kind of.
guifa generators in Raku produces Seq so … not bad 19:59
krako[m] that's was what I had in mind but not all languages have this concept
20:01 guifa left
jdv79 looks like raku is ~4x slower on some miro benches on a rpi4 vs a modernish i7 box. wonder how much of that diff is jit based... 20:11
i imagine the jit support for arm64 might have a better chance of happening thanks to apple, right? 20:12
20:17 neshpion left
krako[m] Wait `slurp` an `spurt` to read and write a file ??? neven seen before ! 20:26
*an --> and
El_Che add "in one go" 20:29
20:32 tejr left, tejr joined
krako[m] ? 20:32
El_Che you don't read them line by line 20:33
but at once in memory
krako[m] oh ok !
20:35 brtastic left
El_Che so, you may or may not want that 20:38
20:42 aborazmeh joined
notagoodidea krako[m]: If you want a file line by line, there is `IO.lines` docs.raku.org/routine/lines 20:47
20:48 MasterDuke left
krako[m] thanks notagoodidea ! I start learning Raku by reading the Raku guide but sure, after this I'll read the Raku doc. 20:48
notagoodidea krako[m]: Doing the same (but i tend to be bad at following a book so I am always nerd-snipped by the documentation and what-if question) :D 20:51
20:56 Ven_de_Thiel joined
Ven_de_Thiel o/ 20:56
m: my %h; %h<x>:delete; %h<x> = start 1; 20:57
Ven_de_Thiel m: my %h; %h<x> = start 1;%h<x>:delete; 20:58
krako[m] In the last snippet from raku.guide/#_returning_values, the code doesn't work. 20:59
Is the snippet just informational or is it supposed to work ?
the snippet where `:D` is added. (`Int:D`) 21:00
notagoodidea It is normal. 21:01
21:01 MasterDuke joined
notagoodidea You expect an Int as a return value (defined) and the return value provided is a Rat 21:02
The "lightbulb" box want to explain that you can also test if the return value is defined or not. 21:03
If you do `squared 3` it will work as the 3**2 = 9. 21:04
krako[m] Actually I've wrote the wrong question. By reading without executing the code first, I would assume that `:D` will make the code work. 21:05
I think that's ambiguous.
notagoodidea I agree.
krako[m] That's why I like to run some code examples while reading doc ! 21:06
By just reading the code, you tend to make assumptions that are sometime wrong 21:07
notagoodidea Just remember that :D/:U/:_ are constraints on the argument/return definiteness.
You may open an issue or submit a change if you want : github.com/hankache/rakuguide/issues
21:09 rindolf left
krako[m] Actually, I didn't understood this first. When first reading, I asked myself "why it's used for the `return` because, if function return something it's defined." 21:10
But I think it's more useful when you don't know the return value in advance and a function might return something like `(Any)` after a computation.
Am I right ?
...I hope the previous message wasn't too long and turned into link... 21:11
notagoodidea nope :)
And I could be a return to Nil also
21:12 ilogger2 joined
krako[m] yeah also ! 21:12
That wasn't clear for me on first read
notagoodidea If you force the definiteness of your return, you could let your function fails instead of getting an undefined value of the return type. 21:13
m: my Int $x; say $x.defined;
evalable6 False
krako[m] to be clear : Any is kind of undefined value and Nil is absence of value, right ?!
notagoodidea Any is the almost mother of type object and most of built-in type objects are children of it. 21:14
(almost because on top of Any, you have Mu)
21:15 Sgeo joined
krako[m] yes, I've read this 21:15
notagoodidea Nil is the absence of value or a benign failure yes.
Ven_de_Thiel m: my Promise %h; %h<x>:delete; %h<x> = start 1;
lizmat a kind of a DBI for structured documents ? 21:18
oops... that was for guifa2 ^^ 21:19
21:25 Ven_de_Thiel left 21:30 aborazmeh left
mst krako[m]: oh, dude, if you're enjoying the grammar stuff, the book "A recursive descent into parsing" is amazing 21:34