🦋 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.
Xliff o/ 00:26
m: sub a (@a (Num, Int, Str) ) { say "works!" }; a( (1.0, 1, 'Hi') ) 00:27
camelia Type check failed in binding to parameter '<anon>'; expected Num but got Rat (1.0)
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff m: sub a (@a (Num, Int, Str) ) { say "works!" }; a( (1e0, 1, 'Hi') )
camelia works!
Xliff m: sub a (@a (Num, Int, Str) ) { say "works!" }; a( ('a', 1, 'Hi') )
camelia Type check failed in binding to parameter '<anon>'; expected Num but got Str ("a")
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff m: sub a (@a (Num(), Int(), Str()) ) { say "works!" }; a( ('a', 1, 'Hi') ) 00:28
camelia works!
Xliff m: 'a'.Int.say 00:29
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5a' (indicated by ⏏)
in block <unit> at <tmp> line 1
Xliff m: 'z'.Num.say
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5z' (indicated by ⏏)
in block <unit> at <tmp> line 1
xkr47 how do I best check if a number $n is in a fixed set of numbers? In my case the set is 2, 4, 16 06:12
I can of course do $n == 2 || $n == 4 || $n == 16, but is there a more perl6 way? :) 06:13
moritz_ xkr47: $n == 2|4|16
xkr47 cool.. I tried `(set 2, 4, 16).EXISTS-KEY($base)` :) 06:14
thanks moritz_ 06:15
moritz_ m: say 2 (in) set(2, 4, 16) 06:16
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3say 27⏏5 (in) set(2, 4, 16)
expecting any of:
infix
infix stopper
postfix
statement end
statement…
moritz_ m: say 2 (el) set(2, 4, 16)
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3say 27⏏5 (el) set(2, 4, 16)
expecting any of:
infix
infix stopper
postfix
statement end
statement…
moritz_ forgot how it works
xkr47 :)
m: say 2 (>) set(2,4,16) 06:17
camelia False
jmerelo Hey
xkr47 lol
Geth advent: 80c9f38796 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | raku-advent-2019/schedule
Updates schedule
06:21
Geth doc: 051d9d73a3 | (JJ Merelo)++ | doc/Language/modules.pod6
Required symbols no longer transitively exposed, refs #2632
07:08
tobs m: say 2 (elem) set(2,4,16) 07:32
camelia True
tobs m: say 2 ∈ set(2,4,16) # xkr47: or if you can type it, this is easier to memorize 07:33
camelia True
xkr47 tobs, cool.. how does this compare performance-wise to 2 == 2|4|16 ? 09:35
I think it's about time languages start using unicode.. not for writability, but for readability :)
lizmat m: say 2 (elem) (2,4,16) 09:38
camelia True
lizmat xkr47 tobs you don't have to make it a Set, you just have to use set operators 09:39
the operator will coerce to a Set when needed
xkr47 oh
lizmat in the above example, it even doesn't do that, it just applies set semantics
xkr47 so is it like a Cool think, that lists can behave as Sets ?
thing*
cpan-raku New module released to CPAN! Sys::Utmp (0.0.13) by 03JSTOWE 09:40
xkr47 checking a list for elems might potentially be slower than checking a Set, which might use hash lookups?
lizmat xkr47: true, but building a set is rather expensive *and* you need to process all elements of the list always 09:41
whereas just looking at the list, you can short-circuit as soon as you have a match
as it only needs to return a Bool
xkr47 how about 2|4|16, what does it create? 09:43
lizmat a junction
m: dd 2 | 4 | 16
camelia any(2, 4, 16)
xkr47 also, can't the compiler precompile those fixed-content sets so they don't need to be created but once?
lizmat I think it does, actually 09:44
lizmat m: my @a = 1,2,3; for ^100000 { my $a := 1 (elem) @a }; say now - INIT now 09:47
camelia 0.1676969
lizmat m: my @a = 1,2,3; for ^100000 { my $a := 1 (elem) set(@a) }; say now - INIT now
camelia 1.9227366
lizmat m: for ^100000 { my $a := 1 (elem) set(1,2,3) }; say now - INIT now
camelia 0.0097738
lizmat m: for ^100000 { Nil }; say now - INIT now 09:48
camelia 0.013725
lizmat m: for ^100000 { }; say now - INIT now
camelia 0.0225478
lizmat m: my @a = 1,2,3; for ^100000 { my $a := 4 (elem) @a }; say now - INIT now
camelia 0.23006689
lizmat m: my @a = 1,2,3; for ^100000 { my $a := 4 (elem) set(@a) }; say now - INIT now
camelia 1.8064751
lizmat so, even if the element is not in the list, the list outperforms the set case 09:49
lizmat needs to be afk for a few hours&
cpan-raku New module released to CPAN! Sys::Lastlog (0.0.11) by 03JSTOWE 09:55
chloekek p6: Blob.new(0xFF).decode(‘utf8-c8’).perl.put 10:38
camelia "􏿽xFF"
chloekek Is it possible to get a replacement character instead of the NFG synthetic?
p6: my $str := Blob.new(0xFF).decode(‘utf8-c8’); S:g/\x[10FFFD]x<xdigit>**2/�/.perl.put given $str; 10:44
camelia "􏿽xFF"
chloekek mumble grumble
jnthn m: Blob.new(0xFF).decode("utf8-c8").subst(/<:Co>/, "?", :g).put 10:48
camelia ?
chloekek p6: my $str := Blob.new(0xFF).decode(‘utf8-c8’); S:g/.<?{$/.ord == 0x10FFFD}>/�/.perl.put given $str; 10:49
camelia "�"
jnthn Unless you expect there to be other private use plane things that you don't want to touch, <:Co> is probably the most efficient way
chloekek jnthn: hmm, that would match all private use code points though.
jnthn Really utf8-c8 is designed to be used in places where you'll encode back to utf8-c8 again. 10:52
e.g. when what's desired is preserving the bytes
cpan-raku New module released to CPAN! Linux::Fuser (0.0.12) by 03JSTOWE 10:58
chloekek Yeah, it also appears not to apply normalization. 11:12
It’s not the thing I want to use.
And iconv can only skip invalid sequences, not introduce replacement characters. 11:13
jnthn It uses synthetics for anything not in NFC also, yes, otherwise we again fail to round-trip 11:14
It's designed quite precisely to let you pretend things are strings that aren't really strings but that everyone wants to pretend are anyway :)
chloekek Maybe I could use Inline::Perl5 and use decode from Encoding. 11:17
p6: use Inline::Perl5; 11:18
camelia ===SORRY!===
Could not find Inline::Perl5 at line 1 in:
inst#/home/camelia/.perl6
inst#/home/camelia/rakudo-m-inst-1/share/perl6/site
inst#/home/camelia/rakudo-m-inst-1/share/perl6/vendor
inst#/home/camelia/rakudo-m-inst-1/sh…
cpan-raku New module released to CPAN! Linux::Cpuinfo (0.0.10) by 03JSTOWE 11:22
SmokeMachine the cpan-raku bot could show a link to the module... 11:36
chloekek Actually it would be nice to have this in Rakudo. I’ll look into how much work it would be to add. 11:38
Wait, Encoding::Decoder::Builtin.new takes a replacement argument. 11:41
tyil SmokeMachine: to the module tarball, to a page on raku.modules.org, to the repository (if any), ...? 11:42
SmokeMachine I think to the place where raku.modules.org sends you when you click on the module...
tyil ok, and what if a module doesn't appear there yet? 11:43
modules.raku.org doesn't update as frequently as the bot polls cpan 11:44
SmokeMachine I mean, to modules.raku.org/dist/Bla:cpan:Author if it’s on cpan or to the repo if it’s anywhere else...
tyil if you're willing to make that feature, I'm willing to run it, but it sounds like it's getting harder every sentence 11:45
SmokeMachine maybe it should only show after it’s apearing on modules.raku.org?
tyil so we only update all modules every 8 hours or so, and then spam the channel 11:46
chloekek p6: Blob.new(0xFF).decode(‘utf8’, replacement => ‘�’).perl.say
camelia Malformed UTF-8 at line 1 col 1
in block <unit> at <tmp> line 1
tyil that sounds highly inconvenient to anyone using the channel whenever the lists gets updated
SmokeMachine tyil: I just just think it would be more useful that way (at least for me…) every time I see a module here I’d like to read about, I have to go to that page and usualy it’s not there yet... 11:47
tyil that's why I'm OK with someone adding such a feature if they can come up with a way that's not going to cause other issues 11:48
chloekek p6: Blob.new(0xFF).decode(‘utf8’, replacement => “\x[fffd]”).perl.say
camelia Malformed UTF-8 at line 1 col 1
in block <unit> at <tmp> line 1
SmokeMachine tyil: usualy I see that and try to remember a few hours later to got to modules.raku.org and take a look at it… but most of the time I just forgot...
tyil I don't have the time to make a feature that comes with a dozen exceptions, nor feel like crippling the bot for everyone just so a couple people can have more information 11:49
if you can find a solution that everyone likes, I'm more than open to review and merge it into the bot, though
chloekek What is the replacement kwarg for in decode? 11:50
SmokeMachine tyil: but what’s the intent of the bot? just anounce new modules or make it easier to people take a look at it? (I’m not trying to badmouth the bot or something like that… I’m just saying I’d like that feature...) 11:51
tyil just announce 11:52
SmokeMachine tyil: ok, thank you 11:53
tyil SmokeMachine: fwiw, I have been planning on my own interface that updates at the same pace as raku-cpan, but as I said before, there's a scarcity of time :(
if there's an interface that updates at the same pace, adding a link to such an interface would be easy to implement and an improvement to the bot 11:54
chloekek MoarVM seems to understand the replacement character but for some reason it still croaks: github.com/MoarVM/MoarVM/blob/eb3d...tf8.c#L597 11:57
Oh, that’s for encoding, not for decoding.
p6: use Encoding:from<Perl5>; 12:01
camelia ===SORRY!===
Please install Inline::Perl5 for Perl 5 support.
mscha m: class Coord { has Int $.x; has Int $.y }; say Coord.new(:1x, :2y) === Coord.new(:1x, :2y); 12:13
camelia False
mscha Is there an easy way to make a Class a value type?
mscha I.e., so that Coord.new(:1x, :2y) === Coord.new(:1x, :2y); 12:14
chloekek p6: class Coord { has Int $.x; has Int $.y }; say Coord.new(:1x, :2y).WHICH 12:15
camelia Coord|67159120
chloekek p6: class Coord { has Int $.x; has Int $.y; method WHICH { “Coord|$!x|$!y” } }; say Coord.new(:1x, :2y) === Coord.new(:1x, :2y); 12:16
camelia True
mscha Thanks, chloekek! 12:17
chloekek p6: (1, 2, 3).WHICH.say 12:19
camelia List|68308608
chloekek p6: "foo".WHICH.say
camelia Str|foo
chloekek p6: (foo => 'bar').WHICH.say
camelia Pair|693DF260743BCDECC1EB82467F8ACD44E60587FB
chloekek Interesting.
mscha Lists and pairs are not value types.
m: (1,2,3) === (1,2,3) 12:20
camelia WARNINGS for <tmp>:
Useless use of "===" in expression "(1,2,3) === (1,2,3)" in sink context (line 1)
mscha m: say (1,2,3) === (1,2,3)
camelia False
chloekek mscha: I think WHICH should really return ObjAt, not Str
In particular docs.perl6.org/type/ValueObjAt for “value types”
mscha m: dd 123.WHICH
camelia ValueObjAt.new("Int|123")
chloekek There was an ambiguity with some type of container in the past. 12:21
mscha m: class Coord { has Int $.x; has Int $.y; method WHICH { ValueObjAt.new("Coord|$!x|$!y") } }; say Coord.new(:1x, :2y) === Coord.new(:1x, :2y); 12:22
camelia True
chloekek Pair.WHICH seems to take the hash these days.
mscha So that seems to do the trick.
chloekek p6: Str.WHICH.say 12:23
camelia Str|U58553888
mscha p6: dd Str.WHICH.say
camelia Str|U48429872
Bool::True
chloekek p6: say Str === "U58553888" 12:24
camelia False
chloekek p6: say "U58553888".WHICH
camelia Str|U58553888
mscha p6: dd Str.WHICH
camelia ValueObjAt.new("Str|U58533552")
chloekek p6: dd "U58533552".WHICH
camelia ValueObjAt.new("Str|U58533552")
chloekek Maybe === overloads on :U and :D
cpan-raku New module released to CPAN! GDBM (0.0.5) by 03JSTOWE 12:33
chloekek p6: say &infix:<===> 12:36
camelia &infix:<===>
chloekek p6: say &infix:<===>.perl
camelia proto sub infix:<===> ($?, $?, *%) {*}
chloekek p6: say &infix:<===>.candidates 12:37
camelia (Sub+{Callable[Bool]}.new Sub+{Callable[Bool:D]}.new &infix:<===> &infix:<===> &infix:<===> &infix:<===> &infix:<===> &infix:<===> &infix:<===> &infix:<===> &infix:<===> &infix:<===> &infix:<===> &infix:<===> &infix:<===>)
chloekek lol
p6: say &infix:<===>.candidates.perl
camelia (Sub+{Callable[Bool]}.new, Sub+{Callable[Bool:D]}.new, multi sub infix:<===> (Enumeration:D \a, Enumeration:D \b) { #`(Sub|49933392) ... }, multi sub infix:<===> (Int:D $a, Int:D $b --> Bool) { #`(Sub+{Callable[Bool:D]}|49934152) ... }, multi sub infi…
chloekek Probably special cases a bunch of types for performance reasons.
p6: class C { method WHICH { ValueObjAt.new("C") } }; say C === C.new 12:38
camelia True
lizmat chloekek: if you create your own method WHICH, you should probably make it a multi, and only accept instantiated invocants 12:55
the Mu::WHICH will take care of the uninstantiated one for you 12:56
mscha m: class Coord { has Int $.x; has Int $.y; multi method WHICH(Coord:D) { ValueObjAt.new("Coord|$!x|$!y") } }; say Coord.new(:1x, :2y) === Coord.new(:1x, :2y); 13:05
camelia False
mscha m: class Coord { has Int $.x; has Int $.y; method WHICH { ValueObjAt.new("Coord|$!x|$!y") } }; say Coord.new(:1x, :2y) === Coord.new(:1x, :2y); 13:06
camelia True
mscha lizmat: that doesn't seem to work here... 13:06
chloekek mscha: you must write Coord:D:, not Coord:D, to set the type of the receiver. 13:07
mscha Ah, of course, typo. :-( 13:07
m: class Coord { has Int $.x; has Int $.y; multi method WHICH(Coord:D:) { ValueObjAt.new("Coord|$!x|$!y") } }; say Coord.new(:1x, :2y) === Coord.new(:1x, :2y);
camelia True
lizmat m: class A { multi method WHICH(A:D:) { "foo" } }; dd A.WHICH
camelia ValueObjAt.new("A|U60682432") 13:08
lizmat m: class A { multi method WHICH(A:D:) { "foo" } }; dd A.new.WHICH
camelia "foo"
lizmat Sadly I must be afk again, this time for ±9 hours of Star Wars goodness :-) 13:09
cpan-raku New module released to CPAN! Linux::Fuser (0.0.13) by 03JSTOWE 13:20
xkr47 m: -16.msb 14:28
camelia WARNINGS for <tmp>:
Useless use of "-" in expression "-16.msb" in sink context (line 1)
xkr47 ?-) 14:29
m: (-16).msb
camelia ( no output )
xkr47 m: say (-16).msb
camelia 4
xkr47 is there a shorthand for e.g. `Int.^lookup("Range")` ? 14:42
m: 4.^lookup("Range")(Int) 14:43
camelia ( no output )
xkr47 m: say 4.^lookup("Range")(Int)
camelia -Inf^..^Inf
vrurg_ xkr47: what are you trying to achieve? 14:45
chloekek p6: say -∞ .. ∞ 14:46
camelia -Inf..Inf
chloekek p6: say -∞^..^∞
camelia -Inf^..^Inf
[Coke] . 15:22
Grinnz tyil: there's another possibility and that's what the bot does in perl: include a URL which will eventually work, and leave it up to the target of the URL to resolve that (maybe with some intermediate service) 15:33
in #perl *
tyil hmm 15:35
chloekek p6: my $proc := run(«perl -MEncode -CO -ne ‘print decode('utf-8', $_)’», :in, :bin); $proc.in.write: Blob.new(0x41, 0xFF, 0x42); 15:45
camelia ( no output )
chloekek p6: my $proc := run(«perl -MEncode -CO -ne ‘print decode('utf-8', $_)’», :in, :bin); $proc.in.write: Blob.new(0x41, 0xFF, 0x42); sleep 1 15:46
camelia A�B
chloekek jnthn: found a solution :þ
chloekek p6: my $proc := run(«perl -MEncode -CIO -pe ‘’», :in, :bin); $proc.in.write: Blob.new(0x41, 0xFF, 0x42); sleep 1 15:59
camelia Malformed UTF-8 character (unexpected end of string) in print, <> line 1.
A
Grinnz tbrowder: you seem to be uploading raku dists into the root of your cpan dir 16:03
tbrowder Grinnz: thnx, I don't know why, the Perl 6 thing is in sight, and I haven't done anything different, although I think I noticed something weird a few days ago. I'll investigate further. 16:05
tellable6 2019-12-17T07:05:05Z #raku <jmerelo> tbrowder I finally got tomorrow's article ready, so we can push your article back another day
2019-12-17T17:34:50Z #whateverable <jmerelo> tbrowder correct.
tbrowder Ah, I see, the upload dir is set to '.' and the 'Perl6' has to be explicitly selected--my eyes are getting weak, or I'm not paying close enough attention (or both!!). Thanks for pointing that out--I have several others to fix, too! 16:09
cpan-raku New module released to CPAN! Text::Utils (2.0.1) by 03TBROWDER 16:16
tbrowder Grinnz: i think i have it right now, it takes a while to delete files, but upload is quick. thanks again for pointing that out! 16:42
Grinnz np
guifa SmokeMachine: I’m apparently suffering from post-vacation blindness. Where in Red is the code that defines the `model` declarator? 17:18
SmokeMachine guifa: github.com/FCO/Red/blob/master/lib.../Model.pm6 17:19
guifa: and here it’s exported: github.com/FCO/Red/blob/master/lib/Red.pm6#L39 17:20
guifa AHA! That’s second one was the link that I was missing 17:21
Thanks!
I’m probably going to end up biting off more than I can chew, but for one of my projects I’m going to need to create a custom regex/grammar-like thing, and wanted it to feel like working with any old grammar 17:22
Probably will do a grammar-binary (parsing blobs) first as a proof of concept (plus it’s been a complaint that the current grammars don’t handle binary very well) 17:24
xkr47 vrurg, enlightenment :) 19:02
cpan-raku New module released to CPAN! CSS::Selector::To::XPath (0.0.5) by 03WARRINGD 19:11
MasterDuke huh. i assumed perl would be competitive python in this micro-benchmark ( news.ycombinator.com/item?id=21825222 ) and raku wouldn't, but for 100_000 python takes 0.4s, perl takes 5.4s, and raku gives `===SORRY!===Annotation segment overflows end of stream` after 78s 19:15
jmerelo releasable6: status 19:45
releasable6 jmerelo, Next release in ≈2 days and ≈23 hours. 1 blocker. 0 out of 271 commits logged
tellable6 2019-12-18T16:18:28Z #raku-dev <tbrowder> jmerelo are you going to change the publish date of my article?
releasable6 jmerelo, Details: gist.github.com/ff57bcd56f43a31a03...9e5a30239a
jmerelo .tell tbrowder not any more, I guess. It'll stay for the 20th.
tellable6 jmerelo, I'll pass your message to tbrowder
tbrowder jmerelo: ok, i see it's for the right date--date changes making me woozy! 19:48
Grinnz MasterDuke: that benchmark isn't presented very well, the shown benchmark command is to both parse and execute the script
jmerelo tbrowder: sorry about that, I had so many last-minute shows and no-shows that I kept moving it around
tbrowder what about [Coke]'s emergency post? seems like an emergency to me! 19:49
MasterDuke Grinnz: sure, but i think most people wouldn't expect that to take very long to execute 19:51
Grinnz sure, that's a different concern, but considering it doesn't accomplish anything, it would be hard to benchmark what it usefully does
different languages will of course decide very differently what to do when a variable is assigned something and then nothing else is done 19:52
MasterDuke perl -c takes just about the same amount of time
Grinnz some may optimize for that operation, some may optimize for future operations
MasterDuke raku's parse stage takes 52s 19:54
MasterDuke so 0.5s for python to parse and execute (though execute could be getting optimized away), 5s for perl to syntax check (i don't know a better way to just time perl's parsing), and 52s for raku to parse 19:56
Grinnz perl -c runs the parsing phase yes 19:57
did you use "my" declarations? i bet it would be faster without
MasterDuke i did, i'll try without 19:58
sena_kun isn't cpython parser is a _fast_ chunk of C code, giving python syntax is not as diverse as raku one, and raku parser is in raku, which is not blazingly fast (hopefully, yet)? 19:59
MasterDuke 1s for perl -c without 'my's
i wasn't terribly surprised by the raku results, but i was by perl
Grinnz the 'my' introduces extra work in the parse/compile phase to set up those lexicals 19:59
sena_kun ah, ok 20:00
Grinnz without it will just shove the assignments in global variables, nothing needs to be declared
Grinnz this is of course a bad idea in real code :P 20:00
MasterDuke 1s is obviously much better than 5s, but i still would have expected perl to be faster than python 20:01
Grinnz *shrug*
they are doing so very different things and it's not a real world use case so i'm not sure i'm surprised or care :P 20:02
MasterDuke not really criticizing perl, and yeah, not totally representative
MasterDuke but people were commenting about how generated code tends to be longer than hand-written, so i could imagine something compiling to perl that looked a little more like that 20:03
chloekek MasterDuke: for me it takes Python .77s and Perl .13s 20:50
chloekek And it takes Raku 3.16s 20:53
MasterDuke: In the Perl and Raku versions, did you add \n to the print statement? Maybe it’s slow due to line buffering requiring lots of allocations.
MasterDuke chloekek: are you timing printing out the statements? or running the resulting file? 20:54
my times were for running the resulting file
chloekek Oh I see.
chloekek lol yeah that’s probably not going to end well 20:55
cpan-raku New module released to CPAN! RedX::HashedPassword (0.0.3) by 03JSTOWE 20:58
Juerd I registered the domain useraku.org but have no plans for it. Does anyone here want it? 21:02
chloekek Could be a redirect to marketing.raku.org/ 21:16
xkr47 oh man lovely material at chloekek 21:27
.. 's link
chloekek I’m gonna give another go at installing Raku packages with Nix 21:28
I want to get Inline::Perl5 working.
Xliff o/ 21:39
guifa \o
Xliff When the move to Raku is complete, will we be changing the "use v6" pragmas?
Kaiepi .tell jmerelo, my draft for the 24th's article will be ready tomorrow 21:40
tellable6 Kaiepi, I'll pass your message to jmerelo
chloekek Ugh, running into the NativeCall issue again. 21:58
But I can’t find the IRC logs with the solution I found last time.
It can’t find NativeCall when installing with install-dist.p6. 22:00
chloekek Ah yeah, I have to include the repository I’m installing into in PERL6LIB when installing with install-dist.p6. 22:05
Like this: PERL6LIB=inst\#foobar install-dist.p6 --from=src --to=inst\#foobar
chloekek Oh wow, I got it working with Inline::Perl5. 22:32
lizmat Juerd: please contact rba 22:40
Juerd rba: ^ (tl;dr: I have useraku.org and can transfer it) 22:42
I decided to get rid of the account it's under. Originally I was going to keep it for a year but they don't do domain expiry, only automatic renewal :(
chloekek Inline::Perl5 is really neat, nine++ 22:44
chloekek Is the dependency on LibraryMake needed though? I got it working just fine without LibraryMake. 22:56