🦋 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 inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
moon-child hmm, why can't you atomic-fetch, atomic-assign, or cas non-ints? 00:02
patrickb moon-child: The atomic ops are directly wired to a hardware functionality of the CPU, and that requires ints to work. 00:03
moon-child patrickb: you can atomically store, load, or cas any word. The CPU doesn't care if that word represents a pointer or an integer at the language level 00:04
ugexe yeah a MWSR using atomic int or cas was my initial thought 00:05
patrickb moon-child: What other native word size things do you have in mind that atomic ops would be useful on? 00:06
moon-child patrickb: raku objects have identity; and they are boxed, so they are represented by a pointer, that is a word 00:07
patrickb What semantic should modifying an object pointer in Raku have? 00:09
moon-child same as assignment... 00:12
ugexe github.com/Raku/roast/blob/dffc2a4....t#L22-L24
moon-child ah, that works! Docs are out of date 00:13
ugexe github.com/jnthn/p6-concurrent-sta.../Stack.pm6 is also a good example 00:23
patrickb I'm off to bed. Thanks so far for everyone having a look. I'll backlog tomorrow, so please write, should you have another idea / comment. 00:32
moon-child night! 00:33
moon-child m: sub f (--> Int) {}; say f 01:16
camelia Nil
moon-child why?
[Coke] you didn't return anything, so Nil? 01:29
m: sub f() {} ; say f
camelia Nil
moon-child but I specified that the result should be an Int. So I would expect either an error or an Int type object 01:30
[Coke] Yes. Nil is special.
m: sub f(-->Int) {"hi"} ; say f
camelia Type check failed for return value; expected Int but got Str ("hi")
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
[Coke] docs.raku.org/type/Nil 01:31
"The value Nil may be used to fill a spot where a value would normally go, and in so doing, explicitly indicate that no value is present."
the first few paragraphs cover your question, I think. 01:32
esp: "Along with Failure, Nil and its subclasses may always be returned from a routine even when the routine specifies a particular return type. "
moon-child ahh, ok! 01:35
[Coke] m: Nil.is.a.special.value.say 01:43
camelia Nil
lucs This looks a bit complicated, can it be simplified?: 02:13
m: my $t = DateTime.now; my $s = $t.second; note $t.posix + ($s - $s.truncate) 02:14
camelia 1637201640.9526284
moon-child hmm, I could have sworn there was a function called 'frac' or some such to replace $s - $s.truncate, but apparently not 02:21
lucs Oh, rereading the DateTime doc page, there is an Instant method that does it right off the bat 02:32
m: note DateTime.now.Instant;
camelia Instant:1637202801.88565274
lucs *phew* 02:33
m: note DateTime.now.Instant.Num 02:36
camelia 1637203042.7485209
moon-child m: say now.Num 02:39
camelia 1637203182.772122
lucs Fair enough :) 02:45
moon-child :) 02:46
lucs I love this language. 02:47
bruceAxtens > 'ACTU'.split("").Array.map(-> $v { $v.ord }) gives me (Nil 65 67 84 85 Nil) 03:43
Where are the Nil values coming from and how do I not get them
kjp There is "nothing" before the "A", so the string is split there, giving the first Nil, and similarly at the end. 04:02
Generally in raku, if you want to specify what you want to keep, then use comb rather than split, so something like 'ACTU'.comb('.') would do. 04:03
m: 'ACTU'.comb('.') 04:04
camelia ( no output )
Xliff m: 'ACTU'.comb('.').gist.say
camelia ()
kjp m: 'ACTU'.comb('.').say
camelia ()
Xliff m: 'ACTU'.comb(/./).gist.say
camelia (A C T U)
kjp m: 'ACTU'.comb(/./).say
camelia (A C T U)
elcaro the `/./` is not necessary if you just want chars 04:29
m: say 'ACTU'.comb
camelia (A C T U)
elcaro m: say 'ACTU'.comb».ord
camelia (65 67 84 85)
elcaro m: say 'ACTU'.ords # or just this if you want ords 04:30
camelia (65 67 84 85)
Xliff Anyone interesetd in TUS? 05:08
tus.io/protocols/resumable-upload.html
tbrowder m: my $doy=132;my $y=2021;my $t=Date.new(:year($y).later(:days($doy-1);say $t.day-of-year 11:21
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use variable $t in declaration to initialize itself
at <tmp>:1
------> 3.new(:year($y).later(:days($doy-1);say $7⏏5t.day-of-year
expecting any of:
argument list
tbrowder m: my $d=25;my $y=2021;my $t = Date.new(:year($y)).later(:days($d-1));say $t.day-of-year 11:24
camelia 25
tbrowder .tell lizmat i'm not sure Date.new from year, year-day is justifiable ^^^ 11:26
tellable6 tbrowder, I'll pass your message to lizmat
lizmat tbrowder: yes, I was aware of that, and it's even simpler (code wise) 11:45
tellable6 2021-11-18T11:26:37Z #raku <tbrowder> lizmat i'm not sure Date.new from year, year-day is justifiable ^^^
lizmat m: dd Date.new(:year(2021)) - 1 + 45 # the 45th day of the year 2021
camelia Date.new(2021,2,14)
lizmat m: sub yearday($year, $day) { Date.new($year - 1, 12,31) + $day } # tbrowder probably the most efficient 12:08
camelia ( no output )
lizmat meh, still 18 submissions to go for the Advent Calendar: github.com/Raku/advent/blob/master...authors.md 12:59
lizmat PSA: logs.liz.nl now running on refactored IRC::Log and many other improvements, using less CPU and less memory 13:30
now on to using Cro 0.8.7 :-) 13:32
tib The ephemeral miniconf is going LIVE NOW: us02web.zoom.us/j/81869065466?pwd=...dPaTFuZz09 13:51
MasterDuke oh, i thought i would be able to attend, but turns out i have a bunch of stuff already scheduled. will the presentations be recorded? 13:54
tib JJ Merelo speaking right now 14:16
MasterDuke yes but not all
Nemokosch is JJ Merelo Spanish? 14:20
MasterDuke yes 14:21
Nemokosch Nice 😄 14:23
[Coke] m: dd "ABCD".split('', :skip-empty) 14:31
camelia ("A", "B", "C", "D").Seq
[Coke] .comb is usually better for this use case, but you can use split. 14:32
RaycatWhoDat When making a grammar, what is the correct way to look for delimited block if the delimiters are on separate lines? 14:54
tbrowder lizmat: thnx, i didn't know Date could be incremented like that. i think i was confusing incrementing DateTime by duration of seconds. yr method is very handy. 15:18
tib (I will run a very small Raku quiz after jjatria QAs at the ephemeral mininconf) 15:39
tib (sjn won) 15:55
El_Che sjn, damn that guy, he's just too nice ;) 16:12
sjn pfft 16:14
I won because Kahoot is a made by a Norwegian country, so I get a "home advantage" :D
s/country/company/ 16:15
El_Che you were in kahoot with them!
s
sjn exactly! :-D
suman say $_ if $_~~ /regex/ for "file".IO.lines gives the line that match the regex. 16:19
How to get the line immediately after the match?
sjn reads certitude.consulting/blog/en/invis...-backdoor/ 16:36
sjn Would it be sensible that the parser warns if it detects invisible/nonprintable characters in the code? 16:36
sjn (maybe this should be in #raku-dev) 16:37
El_Che weekly: github.com/dha twitter.com/GinaRSnape/status/1460...9101740033 both raku and perl community passed away 17:32
notable6 El_Che, Noted! (weekly)
Nemokosch rip 17:44
daxim raku job jobs.perl.org/job/21831 20:47
El_Che Desired skills: - German language :)
daxim could be worse
El_Che if I squint a little I can read it, I speak dutch :) 20:48
daxim I have visited nl about a dozen times and will reflect that notion 🤝 20:51
El_Che when there keep driving south and you'll meet my blend of dutch (Belgium, Flanders)
I sould like lizmat, but more polite :P 20:52
lizmat but less direct :-) 20:56
El_Che :P
Xliff_ What does this error mean? "const_n32 NYI" 22:16
El_Che not yet implemented? 22:17
moon-child load of literal/constant 32-bit [floating-point] number is not yet implemented
[Coke] github.com/MoarVM/MoarVM/blob/mast...erp.c#L220 22:19
[Coke] how did you trigger it, OOC? 22:24
(wondering how hard it would be to implement MVM_BC_get_N32)
Xliff_ Um. There is a problem. 22:26
Global value set in package is NOT equivalent to said value in INIT block. 22:27
MasterDuke that kind of error usually means memory corruption 22:42
Geth doc: cd32380ab4 | (Marc Chantreux)++ | doc/Language/5to6-nutshell.pod6
simpler explanation of $RAKULIB

also remove reference to $PERL6LIB.
23:01
linkable6 Link: docs.raku.org/language/5to6-nutshell