🦋 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.
00:04 reportable6 joined 00:27 sourceable6 joined, bisectable6 joined 00:28 evalable6 joined, linkable6 joined, greppable6 joined
thowe I always use rakudobrew, is that not what the cool kids do anymore? 01:07
ugexe the cool kids use rakubrew 01:24
moon-child what are those? 01:25
moon-child just builds from source
01:26 benchable6 joined 01:28 shareable6 joined 01:52 keutoi joined 02:14 PotatoGim left 02:24 PotatoGim joined 02:25 rakuUser left
Geth doc: 81ddc2686b | Coke++ | xt/examples-compilation.t
Fix heuristic

previous version tripped over 'subset', mistaking it for a sub.
Add 'submethod'
03:02
doc: b6bccb6d43 | Coke++ | doc/Language/typesystem.pod6
Fix example compilation

These need to be separate blocks since they're redefining the same thing.
They also need a preamble because they are using A & B
linkable6 Link: docs.raku.org/language/typesystem
doc: 1f3f3e4fd4 | Coke++ | 7 files
Pass xt/examples-compilation
03:10 mmlj4 joined 03:11 mmlj4 left 03:27 nativecallable6 joined 03:40 squashable6 left 04:09 lizmat_ joined 04:11 RakuIRCLogger left, Geth left 04:12 TempIRCLogger left, lizmat left 04:57 kjp left 05:03 kjp joined 05:40 frost joined 05:41 squashable6 joined 06:02 reportable6 left 06:04 reportable6 joined 06:42 lichtkind joined
kybr is there a method for getting the fractional part of a number? 06:46
raydiak I use mod 1. idk if there's a more specialized method 06:50
m: say 2.3 % 1
camelia 0.3
kybr modules.raku.org/dist/Math::FractionalPart 06:51
thanks. i think i will use mod 1 06:52
raydiak yw
moon-child can also do - truncate if you wanna preserve sign 06:57
m: say -2.3 % 1; say -2.3 - truncate -2.3
camelia 0.7
-0.3
moon-child oh--that doesn't just not preserve sign, it mangles it completely. Subtract floor if you wanna discard sign
err 06:58
07:11 jjido joined 07:21 tejr left, tejr_ joined 07:27 lichtkind left 07:45 jaguart left 08:04 tejr_ is now known as tejr 08:18 jjido left 08:34 gugod left 08:39 gugod joined 08:40 Sgeo left 08:43 slu joined 08:52 mattil joined 08:56 spacekookie joined 08:58 lizmat_ left, lizmat joined, RakuIRCLogger joined 08:59 Geth joined 09:00 TempIRCLogger joined
spacekookie howdy! I'm trying to write a raku program that uses a multi sub MAIN to distinguish between different usages. But for some reason only one of my functions is ever called (and prints the help text if I don't provide the needed parameters) dev.spacekookie.de/kookie/nomicon/.../pt-import 09:06
lizmat lose the "--" on the "--version" 09:15
that is, if you want it to work like "foo version"
rather than: "foo --version"
if the latter, change the signature to: :$version! 09:16
aka, a required named parameter "version"
spacekookie ^^
09:17 MasterDuke23 joined
spacekookie Hmm 09:17
That's kinda annoying because neither of them are a standard way of asking for the version of a program x) 09:20
lizmat so what is the standard way of asking the version of a program in your opinion?
spacekookie This is especially weird to me because if I change my functions to be "multi sub f" and then call f(|@*ARGS) then it works
foo --version
lizmat then the signature should be :$version! 09:21
which will make it call that candidate with --version
spacekookie Hmm, yea I guess that works 09:22
Aah yea okay and if I then constrain the type to Bool then I get rid of the ugly --version[=Any] tail in the usage
Thanks!
lizmat yup :-) 09:23
spacekookie coolio :P
09:30 MasterDuke23 left
spacekookie Different question but is there a way to get an index for each element in a list? In RustI would call .enumerate() on the iterator (or .zip(0..)) but looking at the List docs I can't relaly find a function that does something equivalent 10:14
10:19 rakuUser joined 10:47 jjido joined 10:52 slu left
raydiak idk rust, but if I understand correctly you're looking for .antipairs 10:57
that'll give you a list of pairs. it can be assigned to a hash as normal, or you can call .hash explicitly if needed 10:59
11:32 jjido left
lizmat m: my @a =<a b c"; say @a.keys # spacekookie 11:36
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in quote words; couldn't find final '>' (corresponding starter was at line 1)
at <tmp>:1
------> 3a =<a b c"; say @a.keys # spacekookie7⏏5<EOL>
expecting an…
lizmat m: my @a =<a b c>; say @a.keys # spacekookie
camelia (0 1 2)
11:55 jjido joined 11:57 lichtkind joined 12:02 reportable6 left 12:18 perlmaros left 12:28 squashable6 left
raydiak .antipairs is still my final answer but just for reference after a bit of reading, rust's .enumerate would be something along the lines of .pairs.map or .kv.map in raku, and our .zip is the Z operator: `@list Z 0..*` (or the less common synonymous zip function: `zip @list, 0..*`) 12:30
12:44 jjido left 12:46 frost left 12:50 clarjon_1 joined 12:54 clarjon1 left 13:03 keutoi left 13:05 mmat joined, keutoi joined 13:19 jjido joined 14:05 reportable6 joined, TempIRCLogger left 14:13 b2gills left, b2gills joined 14:14 cognominal left, cognominal joined 14:19 jjido left
elcaro weekly: www.youtube.com/watch?v=UVUjnzpQKUo 14:26
notable6 elcaro, Noted! (weekly)
14:32 squashable6 joined 14:46 jjido joined 15:00 perlmaros joined
gfldex elcaro: I could not resist the urge to comment on that video. :-> 15:05
15:37 jjido left 16:12 mmat left 16:22 jjido joined 16:31 neither joined 16:56 keutoi left
Nemokosch omg what a dumb video 16:56
17:56 linkable6 left, evalable6 left 17:57 linkable6 joined 17:58 neshpion joined 18:02 reportable6 left 18:04 reportable6 joined
kybr what are NuT and DeT types? 18:06
> No such method 'gist' for invocant of type 'NuT' 18:09
> Type check failed in binding to parameter '<anon>'; expected Any but got DeT (DeT)
gfldex kybr: those are not buildins 18:10
kybr i have not yet made a minimal example to test, but the NuT/DeT types made me curious, so i'm asking about those.
ugexe where are you reading about Nut and DeT types? 18:11
kybr not; cant find anything so far.
just searched the moarvm github and found nothing. 18:13
ugexe if you have never read anything on these types why do you think they are a thing? 18:14
like i dont know what those are period, let alone in the context of raku 18:15
kybr well, raku error messages mentioned these types and i didn't create them. github.com/rakudo/rakudo/search?q=NuT 18:18
gfldex kybr: if a type defines methods, you can use introspection to get holed of the Method object and call .file and .line on it.
kybr (Nu)merator(T)ype
(De)nominator(T)ype 18:19
ugexe ::NuT = Int
18:19 andinus left 18:20 andinus joined
ugexe its a named typed capture 18:21
although i agree that would be confusing to reference in an error message 18:22
docs.raku.org/type/Signature#Type_captures 18:23
kybr my goodness raku is deep 18:25
18:28 rakuUser left 18:29 rakuUser joined 18:30 rakuUser left 18:34 MasterDuke92 joined 18:40 holyghost left 18:49 neither left
gfldex kybr: indeed. I happen to be falling since 2008. :) 18:53
18:58 evalable6 joined 19:24 TempIRCLogger joined
lizmat . 19:24
19:41 MasterDuke92 left
kybr m: my Numeric @s; @s.push: True; @s[0].say 20:06
camelia True
kybr specifying the type Numeric of an array does not mean that elements are coerced to that type?
there's probably a set of good reasons, but how might i make the coercion automatic 20:07
gfldex The constraint is on @s not the containers inside @s;
kybr aaah. 20:08
gfldex m: my Numeric @s; @s = [ True ];
camelia ( no output )
gfldex m: my Numeric @s; @s := [ True ];
camelia Type check failed in binding; expected Positional[Numeric] but got Array ([Bool::True])
in block <unit> at <tmp> line 1
kybr do i want `my Array[Numeric] @s;`? 20:09
gfldex m: my Numeric @s; @s.push: 'True'; @s[0].say 20:12
camelia Type check failed in assignment to @s; expected Numeric but got Str ("True")
in block <unit> at <tmp> line 1
gfldex kybr: The constraint will do, but Bool is Numeric.
kybr oh no. i had assumed otherwise. 20:13
m: True ~~ Numeric 20:14
camelia ( no output )
kybr m: say True ~~ Numeric
camelia True
kybr m: True.Numeric.^name.say
camelia Int
gfldex m: say 1 + True; 20:15
camelia 2
20:22 neshpion left 20:25 neshpion joined 20:31 mattil left 20:38 rakuUser joined 21:02 rakuUser1 joined 21:06 rakuUser1 left 21:11 Sgeo joined 21:16 rakuUser left 21:19 rakuUser joined 22:19 shareable6 left, linkable6 left, benchable6 left, squashable6 left, nativecallable6 left, notable6 left, quotable6 left, bloatable6 left, releasable6 left, committable6 left, reportable6 left, unicodable6 left, evalable6 left, bisectable6 left, sourceable6 left, greppable6 left, tellable6 left, coverable6 left, statisfiable6 left, sourceable6 joined, notable6 joined, squashable6 joined 22:20 nativecallable6 joined, greppable6 joined 22:21 linkable6 joined, benchable6 joined, releasable6 joined 22:22 committable6 joined, bisectable6 joined 23:19 bloatable6 joined, unicodable6 joined, coverable6 joined 23:20 tellable6 joined, quotable6 joined 23:21 statisfiable6 joined 23:46 lichtkind left