🦋 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.
00:07 Doc_Holliwood left 00:39 dogbert17 left 00:48 marcusr left 00:49 marcusr joined 00:59 dogbert17 joined 01:09 frost-lab joined 01:22 kvw_5 joined 01:25 kvw_5_ left 01:38 oneeggeach joined 02:38 notable6 left, releasable6 left, statisfiable6 left, sourceable6 left, committable6 left, greppable6 left, nativecallable6 left, coverable6 left, quotable6 left, bloatable6 left, tellable6 left, squashable6 left, unicodable6 left, bisectable6 left, shareable6 left, benchable6 left, evalable6 left, linkable6 left, bisectable6 joined 02:39 bloatable6 joined, shareable6 joined, committable6 joined, releasable6 joined, sourceable6 joined, quotable6 joined, unicodable6 joined, statisfiable6 joined, tellable6 joined 02:40 notable6 joined, benchable6 joined, greppable6 joined, nativecallable6 joined, squashable6 joined, coverable6 joined, evalable6 joined 02:41 linkable6 joined 03:41 bloatable6 left, shareable6 left, greppable6 left, tellable6 left, nativecallable6 left, coverable6 left, committable6 left, bisectable6 left, benchable6 left, unicodable6 left, notable6 left, squashable6 left, releasable6 left, evalable6 left, quotable6 left, statisfiable6 left, linkable6 left, sourceable6 left 03:42 releasable6 joined, sourceable6 joined 03:43 nativecallable6 joined, greppable6 joined, benchable6 joined, evalable6 joined, tellable6 joined, statisfiable6 joined, bisectable6 joined, notable6 joined, linkable6 joined, committable6 joined, squashable6 joined 03:44 bloatable6 joined, unicodable6 joined, quotable6 joined, coverable6 joined, shareable6 joined 03:52 swagg_boi joined, swagg_boi left 04:14 neshpion left 04:22 oneeggeach left 04:28 Maylay left 04:30 Maylay joined 04:55 wamba joined 05:01 sno joined 05:12 PlayPause9 joined, Kaiepi left 05:36 kurahaupo left 05:37 andinus left 05:41 Doc_Holliwood joined 05:44 kurahaupo joined 05:45 jmcgnh left 05:48 clarjon1 left 05:51 jmcgnh joined, parabolize left 05:57 wamba left 06:00 stoned75 joined 06:02 kurahaupo left 06:06 Sgeo left 06:10 Doc_Holliwould joined 06:11 Doc_Holliwood left 06:27 ufobat joined 06:31 domidumont joined 06:40 fluca1978 joined
fluca1978 hi, I don't remember, but is there a way to load a class by its name? Like my $foo = 'Bar'; $foo.new; 06:41
06:44 ufobat left 06:45 ufobat joined
moritz_ m: my $name = 'Date'; say ::($name).new 06:47
camelia Cannot call Date.new with no parameters
in block <unit> at <tmp> line 1
moritz_ m: my $name = 'Date'; say ::($name).today 06:48
camelia 2021-04-07
moritz_ fluca1978: ^^ like this, with ::($name)
fluca1978 moritz_: thanks 06:49
06:53 wamba joined, abraxxa joined 06:58 kurahaupo joined, Kaiepi joined, abraxxa left, abraxxa joined 06:59 kurahaupo left 07:03 fluca1978 left 07:22 Doc_Holliwould left 07:30 dakkar joined 07:41 kurahaupo joined 07:47 pecastro joined
moritz_ btw I just learned that the python equivalent of `Hash.keys` doesn't just return an iterator, but an iterable view on the hash keys that support membership test in O(1) 07:52
which is a pretty cool piece of technology, if you ask me
07:58 sena_kun joined 08:01 aborazmeh joined 08:15 wamba left
lizmat moritz_ care to elaborate how that would look in Raku ? 08:26
moritz_ lizmat: huh, good question. Maybe $key eq any(%h.keys()) ? 08:27
python has an "in" operator to test membership
lizmat $key (elem) %hash ? 08:28
moritz_ I guess raku's closest would be the set membership test?
lizmat yup
moritz_ $key (elem) %hash.keys()
lizmat that would work too, but not needed
m: my %h = a => 42; say "a" (elem) %h
camelia True
moritz_ does it currently work in O(1) or O(n)?
lizmat internally, that does an nqp::existskey 08:29
moon-child lizmat: you can do that in python too. The concern is, if you have a Hash.keys object and you didn't get a copy of the original hash, you should be able to ∈ on that without it needing to be O(n)
moritz_ so it doesn't re-build a hash-link thingy for the (elem) operator from a list?
lizmat (elem) on a list just tests each element in turn 08:31
and stops when a match is found
there's no point building a hash for that, as that would visit *each* element, wheras a short-circuiting linear search would look at all elements only in the worst case (no match) 08:32
08:36 aborazmeh left 08:44 b2gills left 08:48 b2gills joined 08:51 ensamvarg is now known as adrian, adrian is now known as ensamvarg, patrickbkr[m] left, Tirifto[m] left 08:52 draco100[m] left, DarthGandalf joined 08:53 PotatoGim joined 08:58 takside joined 09:04 ensamvarg left 09:07 wamba joined, aik|onl joined 09:09 patrickbkr[m] joined 09:12 draco100[m] joined 09:21 Tirifto[m] joined 09:29 cosimo joined 09:47 _jrjsmrtn joined, __jrjsmrtn__ left 09:53 Doc_Holliwood joined, |oLa| left
jjatria samebchase-: FWIW, that's sounds to me like the problem I had when I wrote raku.land/cpan:JJATRIA/Timer::Stopwatch 10:11
10:37 aluaces left 10:39 rindolf joined 10:47 aluaces joined
samebchase- Does anyone know what's happening with the Grammars for binary effort? 10:50
jjatria: Thanks! Let me check out this library 10:51
10:55 |oLa| joined
samebchase- jjatria: the thing is I tried searching in modules.raku.org with combinations of "timeout", "channel", etc. but I guess I should have searched for "timer" 10:56
gist.github.com/alabamenhu/2fec7a8...4a2ae2f04d hmm 10:59
11:05 abraxxa left 11:06 abraxxa joined 11:10 Black_Ribbon left 11:47 MasterDuke left 11:52 Doc_Holliwood left 12:18 kurahaupo left 12:24 wamba left, kurahaupo joined 12:25 wamba joined 13:02 frost-lab left
jjatria samebchase-: Yeah, naming things is hard, searching for them too :) 13:10
I think I was thinking of the Go time.Timer struct when working on that, which might explain why I went with that 13:11
I wrote about my initial use case here: pinguinorodriguez.cl/blog/porting-from-go
jraspass What's the raku equiv to Perl's custom charname aliases? perldoc.perl.org/charnames#CUSTOM-ALIASES , I found docs.raku.org/language/unicode#Name_aliases but it doesn't allow custom aliases afaict. 13:45
El_Che jjatria: interesting 13:46
lizmat jraspass: you can't atm afaik 14:00
14:00 Sgeo joined 14:09 b2gills left
jraspass I figured that would be the case, no worries. 14:16
14:30 b2gills joined 14:38 Doc_Holliwood joined 14:46 aindilis` joined 14:47 aindilis left 14:49 _jrjsmrtn left, __jrjsmrtn__ joined 14:50 aindilis` left 14:51 aindilis joined
demostanis[m] Does Raku have Perl5-like formats? 14:55
jmerelo demostanis[m]: yep. 14:56
demostanis[m] With same syntax?
jmerelo demostanis[m]:mostly, yes. Let me find the reference for you
demostanis[m]: I can't find it now. Give me a second. 14:58
demostanis[m]: So, I take it back. No, there's no such thing. Apparently, that was an initial intention, wasn't done eventually. 15:00
There are other templating systems you can use, however. But they are not native. 15:01
15:02 parabolize joined
demostanis[m] That sucks... Was it not done because nobody was willing to do the work or for other reasons? 15:05
dakkar p5 formats are very global, and rely on global state… so they are a bit out of place in raku 15:06
jmerelo I don't really know... TBH, I didn't use it in Perl that much either. In the 90s, maybe. Now I would probably use YAML or JSON instead.
15:06 mowcat joined
dakkar metacpan.org/pod/Perl6::Form this is probably what the proposal looked like 15:07
15:08 domidumont left 15:12 domidumont joined 15:21 leont left 15:24 leont joined, wamba left, kurahaupo left 15:25 kurahaupo joined
Altreus they're out of place in p5 15:27
wanting them is really asking what to do instead :D
15:31 Doc_Holliwood left
demostanis[m] <Altreus "they're out of place in p5"> `s/p5/p6`? What would be better? 15:32
dakkar a templating system 15:34
(p5 format *are* a templating system, just a peculiar one)
15:34 MasterDuke joined
samebchase- jjatria: Timer::Stopwatch is perfect for what I am trying to do! Thank you. 15:35
Altreus Yeah, although depending on your use case there may be more specific tools 15:39
not sure what template systems are available for raku except Cro::Template
presumably there's a mustache implementation 15:40
dakkar modules.raku.org/t/TEMPLATE more than one ☺ 15:42
Altreus Personally I've learned that the only things I ever want to template are HTML, and template languages are not complex enough for HTML 15:43
[Coke] realizes he doesn't need DOM::Tiny at all since there's an API he can use, whee. 15:44
Altreus better off with a dom manipulator
(Note: A manipulative dom may simply be abusive)
jjatria samebchase-: I'm glad to hear! 15:48
codesections «what template systems are available for raku except Cro::Template» the not-yet-released-as-alpha-but-nearly-there project I've been hacking on recently (Catkin) will be in a similar space 15:55
It's less of a tempting system and more of a functional way to generate HTML (or other text output) from pure Raku code -- similar to how React/similar systems work 15:56
dakkar codesections: ooh, interesting 15:57
codesections (well, except without the JSX layer in between, because Raku is flexible enough that we don't need it)
Altreus good because I hate doing { if condition } <span> {/if } ... {if condition} </span> {/if}
dakkar steal the nice bits, leave the nasty bits 😜 15:58
16:17 mendel joined
jdv79 i wrote a pretty decent "XML generator template" thing for something at $work just using heredocs 16:27
much more interesting than Perl's offering there 16:28
16:40 Wahnwitz joined
Wahnwitz hi there 16:40
16:40 dakkar left 16:41 ufobat left
codesections Wahnwitz: hi and welcome 16:43
Wahnwitz i am get stuck:)  .. I have a list with domain names. And i have a list with keywords. i would like to check whether a domain name contains one of the keywords. For now I read the keywords into a hash and the domain list is read with for (IO.lines). Is there a more elegant way rather than iterating over the keyword hash for each domain name?
hope thats clear :) 16:44
or.. is there a way to use contains(foo) without call it for each key element of an hash?   like   say "yea" if %hash.doesoneofthekeys.contains("bar") 16:47
jdv79 in Perl i might leverage the regex engine and build an alternation type pattern of all keywords and make one call for each of your haystacks (domain) 16:50
but Raku's regex engine is one of the worst performing parts so I'd not do that here. 16:51
codesections Wahnwitz, how about this: 16:53
m: my %kw = (:keyword-one, :keyword-two); say ['www.example.com', 'www.keyword-one.com', 'www.keyword-two.com'].grep: -> $dom { any %kw.keys.map: { $dom.contains: $_ }} 16:54
camelia (www.keyword-one.com www.keyword-two.com)
Wahnwitz i forgot to mention..i the hash i got pairs like "anwalt" -> "kategorie", "blabla" -> kategorie1" etc.. 16:55
ah..sorry 16:56
oke..so far its working..but i need to say the value of the key :) 16:59
16:59 xinming_ joined
Wahnwitz but "any" will help, thx for the hint 17:01
17:02 xinming left
jdv79 i don't think junctions autothread paralelly yet do they? 17:03
lizmat no, they don't
jdv79 so that solution is "elegant" but in the future it *might* be more "performant" 17:04
lizmat yeah, 17:07
though I would not expect it ever to be actually threading unless we're looking at junctions with at least 10s of eigenstates
codesections m: my %kw = (:keyword-one<kat0>, :keyword-two<kat1>); say ['www.example.com', 'www.keyword-one.com', 'www.keyword-two.com'].map: -> $dom { |%kw.map({ $dom.contains(.key) ?? .value !! Empty }) } 17:08
camelia (kat0 kat1)
codesections ^^^ loses a bit in elegance/use of junctions, but prints the value.
lizmat jdv79: currently, I think it would make start to make sense at 10000+ eigenstates at the earliest to make a difference in wallclock
Wahnwitz wtf
wheres the trick that it say now the value? 17:09
17:10 domidumont left
Wahnwitz damn.. i forgot to say that the output need to be "domain;katN" :D 17:11
codesections m: my %kw = (:keyword-one<kat0>, :keyword-two<kat1>); say ['www.example.com', 'www.keyword-one.com', 'www.keyword-two.com'].map: -> $dom { |%kw.map({ $dom.contains(.key) ?? "$dom;{.value}" !! Empty }) }
camelia (www.keyword-one.com;kat0 www.keyword-two.com;kat1)
jdv79 lizmat: at that point might as well use a regex alternation approach once it performs well. geez;)
lizmat jdv79: well, perhaps :-) I'm just saying that at the current state of things, there's no real point in auto-threading of junctions yet 17:13
it would only slow things down
Wahnwitz Thats beautiful :) 17:14
lizmat and the static optimizer even changes something like $a == 1 | 2 | 3 into $a == 1 || $a == 2 || $a == 3
for sufficiently low number of eigenstates (forget if this was 2, 3 or 4)
jdv79 interesting. i think i've seen race speed things up with tens to hundreds and i'm assuming that's not terribly optimized yet. 17:15
Wahnwitz codesections: a last question (anyway thx alot so far) how would this work when i do not have a list rather that just a single domain name (because in the loop there are other checks to do) 17:16
jdv79 not really comparable though. apples to oranges.
codesections jdv79: tens to hundreds of items or batches?
Wahnwitz so (inside a loop) this works say $sld.map: -> $dom { |%branchen.map({ $dom.contains(.key) ?? "$dom;{.value}" !! Empty }) }
jdv79 items 17:17
17:17 vrurg left
Wahnwitz but i really dont need to map that single $sld value, right? 17:17
codesections right. just use it in place of $dom
17:17 MasterDuke left 17:18 vrurg joined, vrurg left
codesections jdv79: interesting. When I've tried to use race, I haven't seen that sort of speedup. According to the docs, it has a default batch size of 64, so I thought there'd be 0 gain for ≤ 64 items (they'd all go to one worker). Am I confused, or are the docs wrong about the default batch size 17:25
lizmat no, that's correct 17:35
but you need a batch size that is large enough so that the batch isn't finished before the scheduler is ready to cue another job 17:36
otherwise you will never get parallelism
codesections yeah, I figured it was something like that (that is, I figured the default batch size was about as low as it could reasonably be, given the costs of parallelism -- which isn't exactly the same as not getting parallelism at all, but is similar in spirit) 17:39
Wahnwitz my %branchen = (:anwalt<recht>, :fussball<sport>); say "anwalt".map: -> $dom { |%branchen.map({ $dom.contains(.key) ?? "$dom;{.value}" !! Empty }) }; 17:40
evalable6 (anwalt;recht)
Wahnwitz that works..but since there is just one lingle label (anwalt) - .map seems to be not the way to go? 17:41
codesections m: my %branchen = (:anwalt<recht>, :fussball<sport>); say given "anwalt" -> $dom {|%branchen.map({ $dom.contains(.key) ?? "$dom;{.value}" !! Empty }) }; 17:43
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of bare "say". In Raku please use: .say if you meant
to call it as a method on $_, or use an explicit invocant or argument,
or use &say to refer to the function as a noun.
at <tmp…
codesections m: my %branchen = (:anwalt<recht>, :fussball<sport>); say do given "anwalt" -> $dom {|%branchen.map({ $dom.contains(.key) ?? "$dom;{.value}" !! Empty }) };
camelia (anwalt;recht)
jdv79 i could be misremembering. it was when race and hyper were implemented and i was foolin with all the knobs...
Wahnwitz codesections so the block is bind to "do given" than? 17:44
codesections yeah. You could also put "anwalt" in a variable in any other way you like too, of course 17:45
Wahnwitz ahh..the block wont work with just using say 17:46
my %branchen = (:anwalt<recht>, :fussball<sport>); 17:47
my $sld = "anwalt"; say do given $sld { |%branchen.map({ $sld.contains(.key) ?? "$sld;{.value}" !! Empty }) };
jdv79 sometimes i get the feeling raku is a 100 year lang that will take 50 to achieve most of its aspirations;)
codesections yeah (which I forgot when first typing the above). By default, given is a statement and doesn't return a value for &say 17:48
Wahnwitz i see..thx again!
this is really sexy 17:49
codesections jdv79: well, part of the point of being a 100 year language is that we have the flexibility to adapt as we add _new_ aspirations. So I hope we'll still have aspirations to achieve in 50+ years -- I just hope they'll be different ones 17:50
similarly, I'm not entirely sure how many of our currently unfulfilled aspirations were goals from a long time ago/which are newly acquired 17:51
jdv79 yeah, i know. im more talking about the "original" (if there is such a thing) vision. basically Perl on steroids. 17:52
Wahnwitz hope so..but raku is really hard to learn
codesections unrelated question: an & reference to a sub is basically a pointer and thus pretty cheap to store/move, right? 17:53
m: sub f { say 'hi' }; my %h = (:key(&f)); %h<key>()
camelia hi
codesections e.g., storing &f in %h ^^^^ is not that costly/isn't copying anything large, right? 17:54
lizmat nope 17:55
Wahnwitz why not? 17:56
lizmat because everything in Raku is an object
so a sub is also an object
Wahnwitz and a reference on an object..is an object?
lizmat with a Perl mindset on, you could consider everything in Raku a reference 17:57
tobs jdv79: so then Raku is bash on steroids on steroids? :-)
lizmat so there's no reference to take
because you could argue, it is already a reference
jdv79 tobs: yes?;) 17:59
18:01 Wahnwitz left, Wahnwitz joined
Wahnwitz probably with a little dose of LSD on top 18:02
18:02 aborazmeh joined
.oO( with the doors of perception wide open )
18:03 patrickb joined
Wahnwitz :) 18:03
18:04 kurahaupo left 18:05 kurahaupo joined
Wahnwitz codesections: the Junction operator(?) is not needed right? Is there a reason why you put it infront of the hash? 18:06
18:09 kurahaupo left
codesections oh, that | was a Slip operator, and isn't needed any more. In one of the earlier versions it was flattening the resulting list so that it wasn't nested. But now you're returning a Str, so it's not doing anything 18:10
Wahnwitz mhm.. i got the "lerning perl6" book from brian.. thats not mentioned there :) 18:11
jdv79 really? nothing bout "flat,Slip,|"? 18:13
Wahnwitz .slip yes - but not the use of | therefore
| is only described regarding Junctions (as far as i dig it..) 18:14
jdv79 might wanna shoot him an email. weird... 18:15
i havent read any books cept shitovs so far
Wahnwitz :D 18:16
18:21 kurahaupo joined 18:25 kurahaupo left
Wahnwitz ah..the | is already described in the "flattening list" chapter, but in the index it only links to the Junction section 18:31
18:32 abraxxa left 18:33 abraxxa joined 18:34 kurahaupo joined, stoned75 left 18:38 MasterDuke joined 18:39 kurahaupo left 18:44 stoned75 joined 18:50 wamba joined
Wahnwitz mhm..just poking around...i have moved that way into a given statement and that wont work:  given $sld { when %branchen.map({ $sld.contains(.key) }) { say "yehhh"; } } 18:52
but it should?
seems that .key is missing there 18:53
%branchen.map({ $sld.contains(.key)}; could be seen as an iteration over %branchen .. or does I miss something? 18:56
18:57 Black_Ribbon joined
MasterDuke you might want .first instead of .map? 18:57
Wahnwitz No such method 'reise' for invocant of type 'Str' 19:01
Did you try to smartmatch against a Pair specifically? If so, then the
key of the Pair should be a valid method name, not 'reise'.
"reise" is the value of the keyword in this case
19:01 Doc_Holliwood joined
Wahnwitz weird 19:01
19:02 vrurg joined
Wahnwitz %branchen = (:anwalt<recht>, :fussball<sport>); my $sld = "anwalt"; given $sld { when %branchen.first({ $sld.contains(.key) }) { say "yehhh"; } } 19:06
m: %branchen = (:anwalt<recht>, :fussball<sport>); my $sld = "anwalt"; given $sld { when %branchen.first({ $sld.contains(.key) }) { say "yehhh"; } } 19:07
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '%branchen' is not declared
at <tmp>:1
------> 3<BOL>7⏏5%branchen = (:anwalt<recht>, :fussball<s
Wahnwitz m: my %branchen = (:anwalt<recht>, :fussball<sport>); my $sld = "anwalt"; given $sld { when %branchen.first({ $sld.contains(.key) }) { say "yehhh"; } }
camelia No such method 'anwalt' for invocant of type 'Str'. Or did you try to
smartmatch against a Pair specifically? If so, then the key of the Pair
should be a valid method name, not 'anwalt'.
in block <unit> at <tmp> line 1
Wahnwitz m: my %branchen = (:anwalt<recht>, :fussball<sport>); my $sld = "anwalt"; say do given $sld { %branchen.map({ $sld.contains(.key) ?? "$sld;{.value}" !! Empty }) };
camelia (anwalt;recht)
Wahnwitz from my understanding it looks like very similar:/ 19:08
mhm ok.. putting the into another block helps 19:11
m: my %branchen = (:anwalt<recht>, :fussball<sport>); my $sld = "anwalt"; given $sld { when { %branchen.first({ $sld.contains(.key) })} { say "yehhh"; } } 19:12
camelia yehhh
19:17 stoned75 left
Wahnwitz oh noo....key is now outside of the block :D 19:17
19:19 stoned75 joined 19:29 rypervenche joined
Wahnwitz that drives me crazy.. 19:29
19:31 vrurg left 19:44 kurahaupo joined 19:48 neshpion joined 19:52 stoned75 left 19:58 Doc_Holliwould joined, Doc_Holliwood left 20:02 Wahnwitz left 20:03 patrickb left 20:06 aborazmeh left, El_Che left 20:08 El_Che joined 20:16 vrurg joined, guifa joined 20:18 kurahaupo left 20:25 vrurg left 20:29 kurahaupo joined 20:43 abraxxa left 20:45 abraxxa joined 20:47 vrurg joined, MasterDuke left, MasterDuke joined 20:49 kurahaupo left 20:51 vrurg left 20:52 vrurg joined 20:57 vrurg left 20:59 MilkmanDan left, MilkmanDan joined, kurahaupo joined 21:04 aborazmeh joined
Doc_Holliwould as an entry for 99-bottles-of-beer.net/, is this too convoluted? pastebin.com/dykj69P1 21:21
21:28 Doc_Holliwood joined, Doc_Holliwould left
Doc_Holliwood i need a new router 21:29
21:35 xinming_ left 21:38 kurahaupo left 21:44 kurahaupo joined 21:45 PlayPause9 left 21:48 abraxxa left
guifa Doc_Holliwood: nice 21:49
Doc_Holliwood uh, thanks. means something if it comes from you 21:50
21:51 abraxxa joined
Doc_Holliwood that probably sounded sarcastic. was not meant to be. 21:51
guifa One thing that’s interesting is the number of ways almost all of the lines can be done
21:52 kurahaupo left
guifa For instance, I tend to use { $n == 1 ?? ‘bottle’ !! ‘bottles’ }, just because it feels more maintanable if you were to switch to, I dunno, geese or something haha 21:53
moon-child I would prefer a separate function plur('bottle',$n)
Doc_Holliwood had that, i figured it would be distracting 21:54
guifa moon-child: yeah, for a larger project absolutely
Doc_Holliwood the sep function i mean
it is also known one can only put maximum of 10 geese on a wall =) 21:55
guifa The variable naming is good too, it helps showing what’s going on
Doc_Holliwood you can put up to 20 geese on a tree though 21:56
guifa 🌳🦢🦢🦢🦢🦢🦢🦢🦢🦢🦢🦢🦢🦢🦢🦢🦢🦢🦢🦢🦢
(okay those are swans but whatever, close enough) 21:57
Have you thought about using do at all? It’s kind of a cool variant of for that sometimes can read better than map 21:58
do for
21:58 mowcat left
moon-child gather for could be cool too 21:58
guifa oh
Doc_Holliwood gather for works
guifa take $one-down 21:59
21:59 kurahaupo joined
guifa ^_^ 21:59
Doc_Holliwood m: say join "-", gather for 1..10;
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3say join "-", gather for 1..107⏏5;
expecting any of:
block or pointy block
Doc_Holliwood m: say join "-", gather for 1..10 { take $_ };
camelia 1-2-3-4-5-6-7-8-9-10
moon-child m: say join '-', gather .take for 1..10 22:00
camelia 1-2-3-4-5-6-7-8-9-10
guifa m: say join '-', do $_ for 1..10 # if you want to avoid taking 22:01
camelia 1-2-3-4-5-6-7-8-9-10
guifa Actually, it’s really cool how a song like that can show off so many different ways of doing stuff
Doc_Holliwood It's trickier than it looks because of the edge cases 22:03
if you simply hack it down you end up with nested ifs
and arguably ugly code
guifa is trying to think of a one liner for it haha 22:04
Doc_Holliwood good luck 22:05
i'm out for the night
22:06 aluaces left
guifa m: sub temp-change { CALLERS::<$*foo> = $*foo + 1  }; my $*foo = 0; say $*foo; { temp-change; say $*foo }; say $*foo 22:08
camelia 0
guifa is there naything I can do inside of temp-change so that the output is 0 1 0?
moon-child not quite the same, but 22:11
m: my $foo = 0; say $foo; { temp $foo = 1 + $foo; say $foo; }; say $foo 22:12
camelia 0
22:26 wamba left 22:40 Doc_Holliwood left 22:41 rindolf left
guifa moon-child: yeah, I’m trying to hide a setting in the dynamic variable that’s inserted into the symbol table with a ‘use’ statement 22:54
22:54 abraxxa left
guifa and then have a sub adjust it for a lexical block 22:54
22:56 abraxxa joined 23:12 Zoommmx joined, Zoommmx left 23:23 sxmx left 23:39 pecastro left
moon-child guifa: temp works for dynamic variables too. I don't think a sub can insert a declaration into its parent 23:40
but perhaps it would be possible to insert a LEAVE phaser?
(This is a little bit similar to the way that dynamic variables are approximated in s7 scheme)
23:43 sxmx joined 23:56 AncientWizard joined 23:59 abraxxa left