🦋 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.
Voldenet m: use NativeCall; my uint8 $x := CArray[uint8].new()[0]; 00:01
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot bind to natively typed variable '$x'; use assignment instead
at <tmp>:1
------> 3l; my uint8 $x := CArray[uint8].new()[0]7⏏5;
Voldenet m: use NativeCall; my Int $x := CArray[uint8].new()[0];
camelia ( no output )
veesh m: use NativeCall; my uint8 $x = CArray[uint8].new(255)[0] 00:23
camelia ( no output )
veesh oops, forgot to print
m: use NativeCall; my uint8 $x = CArray[uint8].new(255)[0]; say $x
camelia 255
veesh that's better 00:23
m: use NativeCall; my uint8 $x = CArray[uint8].new(255)[0]; d $x 00:24
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
d used at line 1
Voldenet actually 00:28
m: use NativeCall; my $x := CArray[uint8].new()[0]; say $x = 244
camelia -12
TreyHarris veesh, fyi: "This is due to the fact that Natives don't know their types because they're just values, without any metadata. In multi-dispatch, you can have a native candidate, but you cannot differentiate different sizes of the same native type. That is, you can have an Int and int candidates, but there would be an ambiguity between, for instance int, atomicint or int64 candidates." 01:24
from docs.raku.org/language/nativetypes...ativetypes
oops
docs.raku.org/language/nativetypes
I mostly love working on an iPad Pro, but its Bluetooth keyboard handling is very, very sub-par 01:25
veesh: so long as the native value is assigned to a single scalar, Raku _could_ work around it by using the namespace's scratchpad (or its implementational equivalent); but as you've shown, once you put it into an array (or a struct or union) Raku permanently loses track of it in a way that would afford full multi support 01:27
Geth doc: 5d568b3fd9 | (Trey Harris)++ | doc/Language/modules-core.pod6
Fix broken .pm6 → rakumod rakudo extlinks

External links to rakudo's GitHub repo using the old file extensions are broken. Fixed.
02:43
linkable6 Link: docs.raku.org/language/modules-core
Geth doc: 2ad2a1ee03 | (Trey Harris)++ | doc/Language/nativetypes.pod6
Document multi ambiguity between int and uint

As veesh++ points out, multis cannot distinguish between `int` and `uint` any more than they can distinguish between `int and `int64`.
03:38
linkable6 Link: docs.raku.org/language/nativetypes
cpan-raku New module released to CPAN! DateTime::Monotonic (0.0.6) by 03JMASLAK 06:48
holyghost I'm busy on probability marginal functions and more Bayesian learning 07:05
The code is on Xliff's server, I'll put it on github next week 07:06
e.g. a posterior approximation
holyghost I've just updated code on github for p6-Game-Bayes and p6-Game-Stats, what I've talked of before 10:03
holyghost I've still ot to process pmf (probability marginal function) into chaos stochastitical systems :-) 10:36
Anyway, it's easy enough 10:37
patrickb 🎺🎺🎺 ANNOUNCEMENT 🎺🎺🎺 11:36
The GSoC organization application deadline is in 4 days!
Those of you who are pondering of whether to mentor should make up their mind soon.
What you need to do when you want to mentor: Go to github.com/perl-foundation-outreac...2020-ideas and create a PR with your project idea listing you as a mentor.
It is fine to list multiple ideas and see which ones students apply for.
lizmat, brrt, jnthn, nine, samcv, vrurg, jmerelo, AlexDaniel, sena-kun, (whoever fells addressed): Kind reminder to make up your mind of whether you want to mentor and on what project. :-) 11:37
lizmat I haz project ideas, but am hesitant about being a mentor 11:37
patrickb ^^
patrickb lizmat: I'm not sure who, but I seem to remember people willing to mentor but not having ideas... 11:38
patrickb lizmat: Also, can we do something about your hesitation? I think it's very ok not to mentor, but it'd be sad to not make up ones mind in time. 11:42
lizmat patrickb: consider you've done something :-) 11:43
sarna hi, what’s the current extension for scripts? still .p6? 11:45
lizmat .raku but only if you have a modern enough Rakudo (2019.11 or later) 11:49
sarna oh neat! thanks 11:50
jmerelo patrickb: thanks for the reminder 11:56
patrickb: I pretty much have my mind made
patrickb jmerelo: You also already have project ideas on the ideas page :-)
jmerelo lizmat: you can propose a project anyway, maybe someone else will take it up as a mentor. I mean, mentors do not have to be tied to projects...
patrickb: but we _do_ need more. 11:57
patrickb: also, we need to start filling the application. Maybe this weekend in Fosdem Makoto and me can do it.
patrickb jmerelo: Great that you are on this! 12:01
jmerelo: Do you intend to change the the project page to how last years page looked? It seems the page is currently mostly targeted to mentors.
sarna how to get an array filled with x 0s? I can’t find anything in the docs, hmm 12:04
lizmat m: my @a is default(0); say @a[9999] 12:05
scimon m: my @a = 0 xx 10;say @a;
camelia 0
[0 0 0 0 0 0 0 0 0 0]
scimon :D
sarna oh neat, thanks :)
jmerelo patrickb: we're still in that phase... We might change it later on, when/if it's accepted 12:06
lizmat sarna: using "is default(0)" is O1, rather than On
patrickb jmerelo: OK, that's what I thought. :-)
sarna lizmat: nice, thanks! 12:09
I’ve noticed some funky behavior though
lizmat sarna: with "is default()" ? 12:10
sarna m: my @a is default([0;0;0]); say @a; @a[0][1] = 3; say @a; say @a[0]
camelia []
[]
[0 3 0]
sarna why is @a after the modification just an empty array?
scimon Oooo I learnt something new today.
sarna (@a[0] is not, interestingly) 12:11
lizmat what you're doing there, is that you're making a shaped array to be the default of an element of the @a array 12:12
is default() is about the *elements* of an array, not about it's shape
sarna oh, hm. I’m trying to make an array of five [0;0;0]s 12:13
lizmat m: dd [0;0;0]
camelia Array element = [0, 0, 0]
lizmat hmmm 12:14
sarna m: my @a = [[0 xx 3] xx 5]; dd @a 12:16
camelia Array @a = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]
sarna this one works, but hm
lizmat sarna: thing is, that what you specify as the default, is a single instance of the value 12:17
sarna oh 12:18
so when I modify it..
then rip :D
shred_alert I just had a eureka moment. If we're generating an instance of some app from a template that template can also be used as a database for information about attributes of generated app. 12:22
Assuming the attributes stay in the same state throughout the lifetime of the generated app
Context: generating VMs from a template. 12:23
uzl[m] .tell jmerelo re documentable, I'll look at it later. In the meantime, since Git[lab|hub] always serve relative links in relation to username.gitlab.io unless they specify otherwise, I just created the following group gitlab.com/rakudocs and a repo which ends serving the site from rakudocs.gitlab.io/. 13:48
tellable6 uzl[m], I'll pass your message to jmerelo
uzl[m] Hi, everyone! I've been messing with the documentation's header layout and css. This is the result: rakudocs.gitlab.io/ 13:51
tellable6 2020-01-30T16:34:29Z #raku <jmerelo> uzl[m] I think there's this issue: github.com/Raku/Documentable/issues/78, very recent. Might that be the problem?
sarna uzl[m]: on mobile it’s a grey header with a very small camelia on the top left 14:07
[Coke] notes about layout/css - menu starts to vanish at smaller width. 14:14
I find it slightly pale for my taste, but that's just me. 14:15
sarna m: my @foo = [1;2;3]; for @foo.kv <-> { say “won’t work” } 14:17
camelia Too many positionals passed; expected 0 arguments but got 1
in block <unit> at <tmp> line 1
sarna can I somehow get the element as mutable and the key as immutable? 14:17
oh heck wait, my example was borked
<sarna> m: my @foo = [1;2;3]; for @foo.kv <-> $index, $val { say “won’t work” } 14:18
sarna sighs
m: my @foo = [1;2;3]; for @foo.kv <-> $index, $val { say “won’t work” }
camelia Parameter '$index' expected a writable container, but got Int value
in block <unit> at <tmp> line 1
sarna here
getting the key as mutable would be okay too of course 14:23
tobs m: my @foo = [1,2,3]; for @foo.kv -> $index, $val is rw { say "$i: ", $val *= 10 }; dd @foo 14:24
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$i' is not declared
at <tmp>:1
------> 3or @foo.kv -> $index, $val is rw { say "7⏏5$i: ", $val *= 10 }; dd @foo
tobs m: my @foo = [1,2,3]; for @foo.kv -> $index, $val is rw { say "$index: ", $val *= 10 }; dd @foo
camelia 0: 10
Array @foo = [10, 20, 30]
1: 20
2: 30
tobs oh, dd goes to $*ERR, so the output is mixed up 14:25
sarna oh cool, thanks tobs 14:26
tobs sarna: not with <-> but with an is rw trait on the $value parameter to the loop body
sarna yeah I think <-> puts rw on everything 14:26
tobs has never seen <-> before
sarna m: my @foo = [1;2;3]; for @foo <-> $number { $number += 1 }; dd @foo 14:27
camelia Array @foo = [2, 3, 4]
metabind p6: Int.^name; 14:56
camelia ( no output )
metabind p6: say Int.^name;
camelia Int
metabind p6: put Int.^name; 14:57
camelia Int
metabind p6: put Int.^mro 14:58
camelia Use of uninitialized value of type Int in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.

in block <unit> at <tmp> line 1
Use of uninitialized value of type Cool in string contex…
metabind p6: put Int.^methods
camelia Method object coerced to string (please use .gist or .raku to do that)
in block <unit> at <tmp> line 1
Method object coerced to string (please use .gist or .raku to do that)
in block <unit> at <tmp> line 1
Method object coerced to string (…
metabind p6: Int.^methods
camelia ( no output )
metabind p6: Int.^methods.gist 14:59
camelia ( no output )
metabind p6: 3.^name 15:00
camelia ( no output )
metabind p6: put 3.^name;
camelia Int
metabind p6: 3.isNaN
camelia ( no output )
metabind p6: say 5.isNaN 15:01
camelia False
metabind If I call Int.^methods, isNaN is listed as a method but it's not a method of any type listed in Int.^mro, and it's not listed as a method in the docs. 15:05
Why is that?
[Coke] Int does Real 15:06
m: Int.^mro 15:07
camelia ( no output )
[Coke] m: dd Int.^mro
camelia (Int, Cool, Any, Mu)
[Coke] mro is showing you classes, not Roles.
metabind There is a section in the docs "routines supplied by role Real" that doesn't mention it
[Coke] can you open a bug at Raku/doc for that? 15:09
m: dd Int.^roles 15:10
camelia (Real, Numeric)
[Coke] m: dd Int.^roles[0].can('isNaN') 15:11
camelia (method isNaN (Real: *%_) { #`(Method|77915504) ... },)
vrurg m: dd Int.^mro: :roles 15:17
camelia Cannot find method 'raku' on 'Real': no method cache and no .^find_method
in block <unit> at <tmp> line 1
vrurg m: say .^name for Int.^mro: :roles
camelia Int
Real
Numeric
Cool
Any
Mu
vrurg [Coke]: ^^^
metabind What's the difference between p6 and dd? 15:22
vrurg metabind: p6? 15:25
metabind evalbot usage 15:26
vrurg Ah! Ok. Dunno, I don't use evalbot. 15:27
[Coke] dd is the rakudo data dumper.
p6: say 'does this do more than moar?'
camelia does this do more than moar?
[Coke] I think p6: defaults to moar, and m: specifically means moar.
vrurg++
vrurg: thought it might exist, but didn't see it when I search for ^mro in the docs. :) 15:28
nine p
vrurg [Coke]: because it's my recent addition with roles overhaul. 15:29
metabind I take it that a lot is still missing from the docs
[Coke] I would say that a lot is NOT missing from the docs.
metabind anything missing is a lot as far as I'm concerned 15:30
being new
metabind p6: dd Str.^mro 15:32
camelia (Str, Cool, Any, Mu)
metabind p6: dd Str.^mro: :roles 15:33
camelia Cannot find method 'raku' on 'Stringy': no method cache and no .^find_method
in block <unit> at <tmp> line 1
metabind m: dd Str.^mro: :roles
camelia Cannot find method 'raku' on 'Stringy': no method cache and no .^find_method
in block <unit> at <tmp> line 1
[Coke] metabind: That probably needs a ticket. 15:38
metabind: in the meantime, if you find anything is missing, please open a ticket, thanks.
metabind I don't have a github account yet. 15:39
moritz no time like now to get one :-) 16:23
metabind okay so, Coke taught me that isNaN *should be* included in the Int documentation but isn't so I need to file a bug, and that dd the rakudo dumper function that helps output things that put/say can/will not, and that .^mro: :roles is a recent addition to the language, great stuff thanks 16:34
\leave
i'm very new to all this
[Coke] \o/ 16:55
jmerelo Hey, [Coke] 17:08
tellable6 hey jmerelo, you have a message: gist.github.com/ac4b35c9dd11630d21...e0077cf88f
jmerelo .tell uzl[m] great, thanks!
tellable6 jmerelo, I'll pass your message to uzl[m]
sarna m: [0.0e xx 3] 17:15
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3[0.0e7⏏5 xx 3]
sarna I like that error message :^)
jmerelo m: say 3e 17:18
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3say 37⏏5e
jmerelo sarna: well, e is a constant
m: say 3+e
camelia 5.718281828459045
jmerelo sarna: but also exponential
m: say 3e2 + e 17:19
camelia 302.71828182845906
jmerelo m: say 1e
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3say 17⏏5e
jmerelo sarna: confused is about right. Probably it should be a bit more explicit.
sarna jmerelo: yeah, it wasn’t sarcastic - while it could be more informative, I actually kind of like it 17:23
at least shows you where it is, and it’s right about it :)
a nice refresher after programming in go for a while 17:24
jmerelo sarna :-) 17:25
jmerelo Apparently there's no gRPC module for Raku... 18:31
... or protobuf 18:33
guifa assigns gPRC to jmerelo 18:38
jmerelo creates a GSoC project for doing that
guifa doesn’t sign up for it O:-)
jmerelo guifa: we need you as a mentor anyway 18:39
guifa: we need lots of them
guifa jmerelo: fair, but this is my last year I can do it as a student
jmerelo guifa: well, it would be great to have you as a student, but you could propose also a project you'd feel comfortable with 18:42
jmerelo guifa: we can look for mentors later 18:42
guifa Oh, module naming question 18:44
For format parsing 18:45
guifa should we go with Grammar::Name-of-format or Grammar::Foo::Name-of-format and leave the upper level for Grammar::Extension-modifying-grammars-themselves ? 18:45
or is there a different place we should do that? 18:46
jmerelo guifa: he
guifa (like Parsers::Name-of-format or something like that)
jmerelo guifa: Grammar::Extension::Self-Modifying
guifa Ah that actually sounds like a good one for extensions. Should there also be an intermediate one for grammars or keep them top level? (I’m about to post grammars for Hunspell/Aspell/Nuspell/MySpell dictionaries) 18:47
jmerelo guifa: it's pretty much free. There're no guidelines, even. Choose what's helpful to find it. For instance, Grammar::Dictionary::Hunspell 18:49
guifa Yeah, I know there’s no official guidelines, but I feel like since we’re all so early in the ecosystem development, it would be a good idea to have a sort of best practices for naming. Because it would be annoying to have one grammar in Grammar::Dictionary::Hunspell, another one in Lingua::Spelling::MySpell another one in Nuspell (top level) and another one in Text::Spellchecking::Aspell 18:51
jmerelo guifa: but I see Lingua::Spelling as more of a module to use that specific tool, not as a dictionary
guifa: also, that can't be helped. 18:52
guifa jmerelo: I would agree that I’d expect some of those to be a tool, but for developers of them, there’d be no harm in specifying their grammars that could be general use in a more generalized location and pulling from it instead. I also just don’t have time to develop a full [Hun|A|My|Nu]spell engine right now but have the grammar for another project 18:56
TreyHarris From docs.raku.org/language/numerics#Allomorphs : "Keep in mind that allomorphs are simply subclasses of the two (or three) types they represent." '(or three)'? What's a three-type allomorph? 19:48
jmerelo TreyHarris: that's a tough one. 19:53
jmerelo TreyHarris: but I guess that the allomorph XY represents XY, X and Y, right? 19:54
TreyHarris: well, Y is always Str 19:55
TreyHarris jmerelo: oh, no, I think it's just a historical artifact of MidRatStr 19:58
I think "(or three)" can safely be removed
jmerelo TreyHarris: will you do the honor? You want me to do it? 19:59
TreyHarris jmerelo: already on it
jmerelo TreyHarris: thanks.
Geth doc: 42ab3dfefc | (Trey Harris)++ | doc/Language/numerics.pod6
Remove detritus from MidRatStr reference

When allomorphs were first documented in dcd83b, `MidRatStr` still existed as a three-superclass allomorph. That's no longer the case, so remove language referring to hypothetical three-class allomorphs.
But leave open the possibility so this passage isn't brittle against future allomorphs.
20:08
linkable6 Link: docs.raku.org/language/numerics
doc: 26b1a19ca4 | (Trey Harris)++ | doc/Language/numerics.pod6
Wrap numerics "Coercion of allomorphs"

Separate commit to keep semantics & formatting changes separate.
cpan-raku New module released to CPAN! Date::Calendar::Hebrew (0.0.3) by 03JFORGET
TreyHarris m: say so "12" ~~ 12 20:26
camelia True
TreyHarris how can you do ↑ with Numeric or Int rather than specifying the value 12? 20:27
IOW, how can I check a Str (or other concrete value) to see if it can successfully coerce into some specified type? 20:29
guifa hmm, there’s a few different ways depending on your ultimately goal 20:31
Does it have a coercion method?
TreyHarris m: my $x = "12"; say $x.^name; say "{$x + 2}" 20:32
camelia Str
14
guifa my $a = "A"; say $a.^find_method("Int”) // False; say $a.^find_method(“CantCoerceToThis”) // False
err
m: my $a = "A"; say $a.^find_method("Int”) // False; say $a.^find_method(“CantCoerceToThis”) // False 20:33
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in double quotes; couldn't find final '"' (corresponding starter was at line 1)
at <tmp>:1
------> 3find_method(“CantCoerceToThis”) // False7⏏5<EOL>
expect…
guifa *sigh* stupid computer autocoverting quotes
m: my $a = "A"; say $a.^find_method("Foo") // False; say $a.^find_method("CantCoerceToThis") // False;
camelia False
False
guifa m: my $a = "A"; say $a.^find_method("Int") // False; say $a.^find_method("CantCoerceToThis") // False;
camelia Int
False
guifa TreyHarris: see the last one I posted there, if the $foo.^find_method(nameOfClass) returns a defined object, you can theoretically coerce 20:34
TreyHarris m: say "12".^find_method("Numeric")
camelia Numeric
guifa But just because a coercion method exists doesn’t mean you actually will be able to coerce. The only way to test for that is to actually run the coercion 20:34
TreyHarris m: say "boo this is not a number".^find_method("Numeric") 20:35
camelia Numeric
TreyHarris guifa: yes, but: 20:35
m: say so "12" ~~ 12; say so say so "12" ~~ Any(Numeric)
camelia True
False
True
20:36
TreyHarris er
m: say so "12" ~~ 12; say so "12" ~~ Any(Numeric)
camelia True
False
TreyHarris if I don't know the value I'll end up with, how do I do it?
catch an exception?
guifa Probably the easiest way to do it. If you wanted to, you could possibly write a sub for it. Lemme see what I can come up with real fast 20:37
MasterDuke val perhaps would be useful 20:39
val()
TreyHarris odd: 20:51
m: sub get-num($x) { CATCH { when X::Str::Numeric { .^name.say; .message.say } }; return $x.Numeric }; for ("12", "\c[FULLWIDTH DIGIT ONE,FULLWIDTH DIGIT TWO]") -> $n { say get-num($n) }
camelia 12
12
TreyHarris but
m: sub get-num($x) { CATCH { when X::Str::Numeric { .^name.say; .message.say } }; return $x.Numeric }; for ("12", "\c[FULLWIDTH DIGIT ONE,FULLWIDTH DIGIT TWO]", "\c[ROMAN NUMERAL TWELVE]") -> $n { say get-num($n) } 20:52
camelia 12
Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5Ⅻ' (indicated by ⏏)
in sub get-num at <tmp> line 1
in block <unit> at <tmp> line 1

12
TreyHarris Why doesn't the second one work there
tyil samcv: home.tyil.nl/git/raku/Pod::To::Anything/about/ this is the base module I use for Pod6 stuff 21:40
samcv: this is the thing used for rendering Pod6 readmes on my cgit instance home.tyil.nl/git/raku/Pod::To::HTM...ion/about/ 21:46
Ven`` jnthn: as it turns out, adding default params to cro template is *really* easy, but that would be absolute hell in the JS backend :P. 21:59
jnthn Ven_de_Thiel: Even if restricted only to nameds? 22:08
Ven_de_Thiel jnthn: I mean, grammar-wise 22:11
jnthn Yes, but I thought the nameds in the JS compilation were done by forming a "hash"? 22:12
Ven_de_Thiel yes, but JS doesn§t have default parameters
so when we `make $/` after parsing `<.identifier> [ '=' <.expression> ]?` 22:13
JS doesn't like it
I guess recent javascript version (ES6+) actually has defaults, so maybe it's fine... 22:14
rypervenche How might I use Raku to open an image (say a jpg) for viewing? Would that require a module? 22:21
Grinnz the linux only solution would be to run xdg-open on the filename 22:22
rypervenche Ah, is that how people would do it? 22:27
El_Che write a small lib that checks the OS and open xdg-open/open/start accordingly? 22:57
uzl[m] .tell sarna Still trying to figure out how to make the grid layout work for smaller screen size. Pretty much a CSS noob ;-). 23:12
tellable6 uzl[m], I'll pass your message to sarna
uzl[m] .tell [Coke] re layout/css: Do you have any color scheme in mind? I myself find it too pale. 23:15
tellable6 uzl[m], I'll pass your message to [Coke]