🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
NemokoschKiwi m: subset Nummie of Int where 1 .. 25; sub MAIN('run', Nummie :$test) { say 'RUNS.' }; @*ARGS = 'run'; 00:16
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 Int in string context.
Me…
NemokoschKiwi subsets really don't play nicely with the CLI 00:16
m: sub MAIN('run', Int:$test) { say 'RUNS.' }; @*ARGS = 'run'; 00:17
camelia RUNS.
NemokoschKiwi Is there a way to make the subset accept omission the way Int allows it?
Nemokosch github.com/rakudo/rakudo/issues/5079 somebody to close this? 01:37
gfldex m: subset Nummie of Int where 1 .. 25; sub MAIN('run', Nummie :$test = 1) { say 'RUNS.' }; @*ARGS = 'run'; 03:02
camelia RUNS.
Nemokosch the idea was to allow omission of the argument 03:19
cbk Is it possible for a Raku script to set an environment variable in the shell from which it was called.  (I want the script to parse a file, look for  certain key-value pairs, then do some magic like iterate over list of key-value pairs and do an export key=$value.) 04:59
jaguart You want your process to export into it's parent shell? Isn't that a classic-hard problem 05:29
cbk yes 05:30
jaguart stackoverflow.com/questions/263005...vironment. 05:32
it's a hard problem, kind of my design
=~s/my/by/
cbk I have a text document I want to take notes in.  anytime the file is updated,  I want Raku to read the file grab the key=value pairs then in a shell export 05:33
yeah its hard but thats why I use Raku?
jaguart no its hard because of the security architecture of shells
doesnt matter which lang you use
cbk I may just have to write a Raku shell :( 05:34
jaguart You can set the values into something like .bashrc-local and source that from within your parent shell 05:35
then you just set an alias to run your script and source the new values
cbk Cool,  I'm looking at that now.  So crazy it may just work.  Thanks 05:37
jaguart What are the updated ENV vars being used for?
cbk jaguart++
is '++" still a thing?
jaguart feels a little increment of happiness 05:38
cbk Nice!
jaguart Can anyone point me to a working example of class-block trailing pod-declarator? My class-block trailing POD all seems to end up on the last attribute/method inside the class. Leading WHEREFORE works as expected. FWIW I'm using Module::Pod to spruik them. 05:42
as in: #| starts ok\n class Apple { method crunch() {...} }\n #= Apple ends. 05:44
The Apple Ends.WHEREFORE is crunch() trailing. :(
this is also odd: #| starts ok\n class Apple { method crunch() {...}\n #= last bite.\n }\n #= Apple ends. 05:49
I get one Pod::Block::Declarator with 'last bite. Apple ends.' in trailing, WHEREFORE is crunch() --> :( 05:50
CIAvash jaguart: only this seems to work when class is not empty: `#| starts ok\n class Apple { \n #= Apple ends. method crunch() {...} }` 06:23
jaguart oh interesting :) so trailing is just inside the beginning of the class declaration 06:34
mscha m: my @arr = (1,2,3),(4,5,6),(7,8,9),(10,11,12); say @arr[1^..*]; # works 10:06
camelia ((7 8 9) (10 11 12))
mscha m: my @arr = (1,2,3),(4,5,6),(7,8,9),(10,11,12); say @arr[1^..*;1]; # hangs
camelia (timeout) 10:07
mscha Is this a bug or (not) a feature?
Nemokosch It doesn't seem appealing or reasonable, that's for sure. It might be just unimplemented; the question is if there is anything particularly different about it 10:08
github.com/rakudo/rakudo/blob/2022...ce.pm6#L57 I think this is the call that backs it up 10:11
Nemokosch bisectable6: my @arr = (1,2,3),(4,5,6),(7,8,9),(10,11,12); say @arr[1^..*;1]; 10:30
bisectable6 Nemokosch, Will bisect the whole range automagically because no endpoints were provided, hang tight
tellable6 2022-12-05T16:03:03Z #raku <japhb> Nemokosch $*IN.lines tries to empty stdin all the way to EOF. So you're starving the REPL.
2022-12-06T16:39:13Z #raku <SmokeMachine> Nemokosch: that's the smallestt problem IMHO... there are 2 posts for the same day...
2022-12-07T16:32:01Z #raku <Xliff> Nemokosch: Apparently not in my code. a({ ... }) results in an error.
hey Nemokosch, you have a message: gist.github.com/0c6124a1a06ebcd2c7...6b207ed115
Nemokosch I really, really hope there is some timeout for something that hangs... 10:32
Nemokosch anyway, hoping that I didn't drive the bot into an infinite loop, mscha: I think I can see the problem 10:37
github.com/rakudo/rakudo/blob/63ea...ce.pm6#L10 this is exactly where the oversimplification lies 10:47
hello19 yo 11:28
does the container of an element in a shaped array know about its position in the array? and if so, how do I ask for it 11:29
lizmat it doesn't 11:42
El_Che ... or does it? 11:45
(no it doesn't :) )
Nemokosch What do you think would be a good place for surveys/polls for Raku users? 11:55
this Pair.freeze issue really made me think... how many people think Pair is a value type, or at least use it as if it were well-suited for that 11:56
sometimes I feel for myself that I blindly believe in using it simply because the funky-looking syntax and the name 11:57
for function return values... is there a separate `is rw` and `is raw` trait? Why is this docs.raku.org/type/Pair#method_value marked with `is rw` when the behavior is more like `is raw`? 12:40
mscha m: say $*RAKU.version, ' ', $*RAKU.compiler.version; 13:08
camelia v6.d v2022.12.1.gd.52342.eb.0
SmokeMachine is there a way to `.wrap()`a accessor of an attribute? I'm playing with this idea glot.io/snippets/gg56bgwmhr, but I'd like to make it also work when calling accessors of a ìs rw` attribute... otherwise I'll probably have to insert a proxy there... 14:17
Nemokosch m: use v6.e.PREVIEW; my @arr = (1,2,3),(4,5,6),(7,8,9),(10,11,12); say @arr[1^..*;1]; 14:27
oops
I need to do this somewhere else 14:28
[Coke] can I use RESOURCES without installation? I want to be able to refer to a config file anywhere in my checkout without having to worry about the path. (be nice if I could also refer to it when invoking a script that exists inside the checkout but I call the script from (e.g.) "C:\") 15:20
Geth doc: 7e91a0018b | Coke++ | doc/Language/classtut.pod6
Fix categories.

  tbrowder++
15:28
linkable6 Link: docs.raku.org/language/classtut
Nemokosch github.com/codesections/advent-of-raku-2022 if y'all are interested - I actually tried to set a kind of example but frankly I'm not really doing the tasks 15:44
[Coke] looks like %?RESOURCES doesn't work with a non-installed version, yes? 17:17
(makes sense) 17:18
ugexe it works 17:27
zef uses %?RESOURCES, and can install itself 17:28
[Coke] ... OH. I was missing a critical bit 17:30
(I didn't reference the module anywhere in my test script). OK, now I'm getting at least an interesting error 17:35
I have raku-lib/path/foo.rakumod which is declared under the provides clause in the meta6.json, I have a resources file domains.json under resources/domains.json; if I use raku -I. something/other/script.raku with dd %?RESOURCES<domains.json>, I get Nil. 17:41
(the script.raku uses the module declared under provides there.) 17:43
nevermind, found your stack overflow answer to this very question 17:45
ugexe++ 17:47
Your previous patience in answering questions still paying dividends. :) 17:48
hello75 i just asked gpt3 for "3 ways to write an infinite loop in raku". this is what it told me: www.paste.org/123566 19:24
which is basically correct
we all gonna be unemplyoyed in 10 years 19:27
jast this just replaces asking easy syntax question on Stack Overflow
El_Che I use copilot and you need to make sure it doesn't propose nice looking nonsense
jast ask it to implement something more uncommon, like a fast fourier transform, in raku 19:28
or fast inverse square
... root
or a golfed version of fizzbuzz :) 19:30
hello75 fizzbuzz
controlc.com/429552ac 19:34
FFR: it found the module by Joelle :D 19:36
so it's picking stuff from the web, but it does a very good job at ot
it
lizmat yeah, it's using superstitious parentheses in the "while (True) {' case, which is pretty Perlish 19:39
jast that's not golfed fizzbuzz though :) 19:43
mscha github.com/mscha/aoc/tree/master/aoc2022 23:03
Nemokosch you can also consider uploading some of it to github.com/codesections/advent-of-raku-2022 😛 23:23