🦋 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.
coleman run("kubectl", "get", "pods", "-n", "greymatter", :out).out.split(/ \s /).grep(/ catalog /).first 00:01
coleman split everything into a Seq of fields (whitespace delimited), then grep that, then take the first 00:01
rf Nemokosch, I fixed it by doing [% set description = meta.description %] then checking the set var 00:05
There is an open issue for it github.com/raku-community-modules/...6/issues/4 00:06
Nemokosch clever 00:07
anyway, for now, I'm going to just refactor the strings and hope that helps better understand the data flow 00:08
cfa coleman: but i thought you wanted to print the matching line
awk-style
rf Nemokosch, thanks
cfa oh, {print $1}, derp 00:09
sorry
coleman shorter: 00:29
run(<kubectl get pods -n greymatter>, :out).out.slurp.match(/catalog <[ - \w \d ]>+ /).first
I forgot that custom character classes are like <[ ]>
docs.raku.org/language/regexes.htm...and_ranges 00:30
s/first/:first/ 00:38
Geth ¦ doc: cfa self-assigned Spin off signature literals github.com/Raku/doc/issues/2686 00:40
Nemokosch rf: are there any claims that indexing would be 1-based? (to be honest: are there any mentions of retrieving data by indexing?) 00:49
github.com/raku-community-modules/...akumod#L17 seems buggy to me 00:50
rf Nemo I don't see anything like that 00:55
That does look a little suspect
Nemokosch by the way, that module kind of implies that you can store arrays and then look them up with the dot 00:58
well, under certain circumstances, at least, not necessarily in a control statement 00:59
but in a get statement, most probably you could
Geth doc/main: a0cb9fce9a | (Will Coleda)++ | util/clean-spell
close IO we're not using
01:45
doc/main: 8c04561348 | (Will Coleda)++ | xt/pws/words.pws
Track latest aspell install
doc/main: 59ffd079ed | (Will Coleda)++ | 2 files
remove unneeded entries
doc: cfa++ created pull request #4233:
Extract a signature literals language page, update links (#2686)
01:56
Nemokosch rf: FYI github.com/raku-community-modules/...fc720cf23b 01:58
rf @Nemo I wonder if Postitional and Associative might be better 02:02
For the smart match
Nemokosch yes, I was thinking about it but then it started bothering me that somebody could overload AT-KEY and AT-POS without implementing any interface and I backed off from this path xD 02:03
going from Hash and Array to Map and List was urgent, though, it's easy to end up with a nested structure that has those types somewhere on the way 02:04
I tripped myself up way too hard with that in the test...
by the way, feel free to make modifications to this module, a commit bit to this organisation is basically for free 02:06
xinming m: sub a { "a".say; }; my &a-old = &a; &a.wrap({ "b".say }); a-old; 02:23
camelia b
xinming In this case, Is there a way to keep the old routine's reference ? 02:24
MasterDuke m: sub a { "a".say; }; my &a-old = &a.clone; &a.wrap({ "b".say }); a-old; 02:26
camelia a
xinming Got it, thanks 02:27
MasterDuke np. not 100% sure how well that would work for methods, but something to experiment with at least 02:28
rf That should work with methods I think 02:30
xinming MasterDuke: Is it possible to not clone, But still reference the internal code entry 07:46
&code.clone achieves what I wanted, But still curious wether we can still access the entry to original code start for the same function. 07:47
So .wrap modify the ref to the new one, Where we still be able to call the old function with manual saved code reference
guifa_ xinming you won't be able to AFAIK without unwrapping. Inside of the wrapper, you can reference it, but not outside. 10:57
tonyo m: sub a {'a'.say;}; &a.wrap(-> { 'b'.say; callwith; }); a; 14:49
camelia b
a
tonyo xinming: like that ^ 14:50
or you can use binding: 14:51
m: sub a {"a".say;}; my &oa := a; a.wrap({"b".say;}); oa();
camelia a
Type check failed in binding; expected Callable but got Bool (Bool::True)
in block <unit> at <tmp> line 1
tonyo m: sub a {"a".say;}; my &oa := &a; a.wrap({"b".say;}); oa(); 14:52
camelia a
No such method 'wrap' for invocant of type 'Bool'. Did you mean any of
these: 'Map', 'Rat', 'WHAT', 'grep', 'map'?
in block <unit> at <tmp> line 1
tonyo ah
tonyo rf: are you in need of a templating system? should i resurrect my old templater (it generated raku code that could be used on the fly or generated and used statically) 14:57
tellable6 tonyo, I'll pass your message to rf
rf Is there any way for a Channel to act as a pub sub? I want to broadcast each message to every react block listening for it 14:58
tellable6 2023-03-02T14:57:13Z #raku <tonyo> rf: are you in need of a templating system? should i resurrect my old templater (it generated raku code that could be used on the fly or generated and used statically)
tonyo rf: iirc you want a supplier
rf tonyo: Yeah actually I'm working to bit a good few thousand lines of Raku into production. I'm using Template6 right now but I think it still needs a lot of work.
tonyo assuming you want a fan out
rf Yeah fanout is what I want 14:59
I'll give it a try thanks
tonyo i'll write an example, one sec
and i'll look at what's good on my template code and whether it can be released or not (so many tools i just write shoddily to get something done and never polish/release)
rf Haha, yeah I get that lol. Humming-Bird is my first library I've tried to polish in years 15:00
tonyo +=5k all the people responsible for the new docs
m: my Supplier $sr .=new; $sr.Supply.tap(-> $v {"1: $v".say;}); $sr.Supply.tap(-> $v {"2: $v".say;}); Supply.from-list(0..5).tap(-> $x { $sr.emit($x); }, done => { $sr.done }); # rf 15:02
camelia 1: 0
2: 0
1: 1
2: 1
1: 2
2: 2
1: 3
2: 3
1: 4
2: 4
1: 5
2: 5
rf Sweet that is perfect. 15:03
tonyo humming bird looks interesting
is this lighter weight than cro?
rf Its ~400 LOC for the core code, and performs about as well. 15:04
tonyo also, are you looking to embed the templating system into HB ?
rf No, HB is mostly focused just on core web functionality, its up to the user to pull in template engines etc
tonyo there's also these: raku.land/zef:tony-o/Event::Emitte...er-Process and raku.land/zef:tony-o/Event::Emitter
rf I'm writing a pretty concurrent web-application in HB mostly for reference and to show it works well :), also using it as an excuse to teach a friend Raku 15:05
That's where supplier comes in 15:06
Geth doc/lizmat-Date-daycount: cf182e3f31 | (Elizabeth Mattijsen)++ | doc/Type/Date.pod6
Document Date.daycount|Int|Numeric
15:17
doc: lizmat++ created pull request #4234:
Document Date.daycount|Int|Numeric
15:18
cfa bisectable6: Date.today.daycount.say 15:20
bisectable6 cfa, Will bisect the whole range automagically because no endpoints were provided, hang tight
cfa, ¦6c (67 commits): «60005␤»
cfa, Nothing to bisect!
cfa lizmat: ^ 15:22
Geth doc/main: bf7a78beee | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | doc/Type/Date.pod6
Document Date.daycount|Int|Numeric (#4234)
lizmat yeah, so probably from day one
cfa nods
Geth doc/main: 6ef34fc5f7 | (Elizabeth Mattijsen)++ | doc/Type/Date.pod6
Also document Date.Real
15:25
tonyo docs.raku.org/syntax/heredocs%20:to 15:29
Geth doc/main: fbba32dabc | (Elizabeth Mattijsen)++ | doc/Type/DateTime.pod6
Document DateTime.Real
15:33
Nemokosch github.com/Raku/doc-website/issues/181
doc/main: 0d25f95ea8 | (Elizabeth Mattijsen)++ | doc/Type/Date.pod6
Add missing invocant markers in Date.methods
doc/main: 63083c66a3 | (Elizabeth Mattijsen)++ | doc/Type/Any.pod6
Document Any.classify|categorize(*)
15:43
Geth doc/main: 1b370f7d29 | (Will Coleda)++ | xt/check-signatures.rakutest
Add test-files note
15:57
rf Is there a method to wipe a Hash? 15:58
lizmat %h = () 16:01
afk& 16:04
rf Is there any way to flush a supply? 16:16
ugexe what does that mean? 16:17
in the context of a supply 16:18
rf I have a channel, after a while the channels contents can become "stale", I want to empty the channels supply
I'd prefer for the consuming code not to have to check the "freshness" of the supplied values 16:19
tonyo do you mean in the way real time stuff becomes stale? eg no point in braking once the back of the semi has disabled the car? 16:21
ugexe what about Supply.stable(...) 16:22
rf Basically I have an infinite data stream being fed into a channel in chunks, consumers will consume as much as possible, but I don't expect to be able to have infinite consumers so some data becomes old (as in time) and thus can't be consumed anymore
Upon noticing a single piece of stale data I can within a small margin of error assume that the rest of the channel is stale, so I should clear it and wait for more data. 16:23
ugexe Seems like you could just close the originally supply and create a new one 16:24
original
rf It isn't super practical, but I think it might perform a lot better than the Database IO stuff its doing rn. 16:25
Can I reassign a channels supply?
ugexe not sure
my guess is each time .Supply is called it would return a new supply
rf Maybe I can just reassign the channel itself 16:26
tonyo i would guess you can just close and reopen the supply 16:52
tonyo rf: i'll add the template stuff to git so you can take a look at it 16:53
github.com/tony-o/raku-protone - you'll have to look at the tests for usage 16:56
Geth docker: d6873e88a8 | (Daniel Mita)++ (committed using GitHub Web editor) | 5 files
Bump to 2023.02 (#53)
16:57
Nemokosch I wouldn't mind pushing Template6 up to a useful level 17:02
(also, I have a pending PR for fez - somebody just commented on it that it would solve their issue as well) 17:03
tonyo ughh template toolkit 17:05
rf tonyo: thanks!
Tbh I don't care who or what, I think we need a really nice templating dist lol 17:06
Looking at yours right now tonyo
tonyo i have a fix i need to push one sec
that was pushed from an older version 17:08
Nemokosch Well my story is as simple as to get a proper solution for the raku.org site, lol 17:22
mowyw is a bit niche...
tonyo rf: just pushed up the more recent version 17:35
t/02 shows it using native funcs as well as registered funcs
so you can do hello {{name.&flip}} (the & is necessary to show it's a native func)
rf Sweet, this looks really good 17:41
tonyo there's likely bugs 17:46
rf I'll play around with it
tonyo nemokosch: are you 2colours? 17:48
tellable6 tonyo, I'll pass your message to Nemokosch
Nemokosch Yep 17:50
tonyo pr is available in v42 17:51
rf Holy crap, this actually worked. 17:56
Infinite data processing at my fingertips
rf @Nemokosch, I am very interested in your maintenance of Template6 mainly because I have a lot of code that uses it already :D 18:06
Geth doc/main: 360bee5538 | (Will Coleda)++ | README.md
clarify spec version
18:09
tonyo what actually worked? 18:14
rf My super distributed system lol 18:18
8 threads with the event loop with really good throughput lol
Nemokosch I mostly chose it because it's the most similar to mowyw, and also it's highly inspired by a well-documented Perl templating system - TT2 18:23
so like, if anything doesn't work, at least I can get an idea what it's supposed to do xD 18:24
cfa tonyo: what's wrong with template toolkit? 18:28
Geth doc/main: 5cb3d5a385 | (Will Coleda)++ | 13 files
Improve skip reporting

Make it more clear why the test was skipped.
18:32
tonyo cfa: it's slow. it goes away from the language that's using it (it's its own mini language) and this makes extensibility difficult. ziprecruiter uses it so i used it for four years as a result. maybe it's better now but it was very easy to find edge cases in when i was using it 18:39
for instance..template-toolkit.org/docs/modules/T...lugin.html <- writing this much code to extend the templating system seems outrageous to me 18:41
conversely, twitter wrote an engine that compiled to code and you could execute.. the templating system i linked rf to also does this albeit more naively 18:43
rf I think DSL's make way more sense for templating
tonyo a DSL is fine, adding to TT's is a pita 18:44
rf When I wrote OCaml professionally, we used github.com/ocsigen/tyxml and it was wonderful
Its nice to have type checking in templates lol 18:45
tonyo rf: that looks great
rf Yeah its really good, I think there's a Haskell style one too 18:45
tonyo i miss jade templating
rf I was thinkin about how hard it would be to write a Handlebars engine for Raku 18:46
tonyo pretty easy i'd reckon 18:48
there exists one already too iirc
rf There's one for mustache
I just find it wayyyyyy too slow
Nemokosch kostas worked on it some time 18:51
but not sure his modifications were ever taken over
tonyo ahhh
rf 18ms to render this page rawley.xyz/bookshelf 18:52
Seems wayyy to long
Nemokosch tbh templating is a good example of the circular nature of development 18:53
cfa ka is a wheel 18:54
Nemokosch you probably start off with plain code. Then you realize that most of your code is actually just plain string
You want to keep it simple, just covering your most urgent demands, telling yourself "I'm not going to use it everywhere" 18:55
Then you want to solve more and more within the templating framework itself, and eventually you end up pondering why you're doing this convoluted garbage in the first place when you could just solve it in code 😂 18:56
rf Yeah lol, that does tend to happen 18:57
Nemokosch the doc website uses a very code-ish system created by finanalyst, he calls it RakuClosures or something like that
it's basically a bunch of callbacks and shared data 18:58
... so now I'm proposing that maybe it could be combined with HTML::Tag where it's appropriate. After all, that's not a templating system, just a tool for creating HTML nodes and generating string from them 18:59
better than counting opening tags and closing tags I'd say
rf tonyo: If you like FP you might like Humming-Bird it's literally one giant function composition :D 19:00
Geth doc/main: 5957cecfc9 | (Will Coleda)++ | xt/link-checker.rakutest
Add first pass at internal link checker

  * Only check primary sources or secondary pages known to exist.
  * complain about .html links - the site shouldn't need them, and POD certainly doesn't
  * Assume website path capitalization is correct for now.
20:37
Geth ¦ doc: coke assigned to lizmat Issue Telemetry::Instrument::AdHoc docs missing github.com/Raku/doc/issues/4235 20:46
doc/main: a3c02f31a4 | (Will Coleda)++ | doc/Type/Telemetry.pod6
remove link to non-existant content

part of #4235, ok to revert when target page exists.
20:48
doc/main: c2770d6d36 | (Will Coleda)++ | 5 files
Fix broken links discovered by xt/link-checker.rakutest
Geth doc: tbrowder++ created pull request #4236:
Change humorous text to technical exposition
21:15
doc/main: 10014cb4a9 | (Tom Browder)++ (committed using GitHub Web editor) | doc/Language/tables.pod6
Change humorous text to technical exposition (#4236)
21:21
rf Is there a variable that stores the machines operating system? 21:39
Like $*OS or something
rf Ah, $*DISTRO, neat 21:41
@Nemokosch, got a new Template6 bug, for some reason [% if foo %] [% foo %] [% end %] is always showing foo, even when I don't pass it to process 21:49
tonyo that seems less than ideal
rf Yeah, it definetley is not great, it's weird because it seems to happen only when the value isn't present rather than when its truthy/fasly 21:55
Nemokosch not even an error? 21:56
rf No, it just shows up.
rf Yeah lol, setting my arg to Nil causes it to disappear 21:57
But I don't want to pass the arg
If I don't pass it it shows up
Hmm, could it be because the variable is hidden behind an INCLUDE 21:58
Or does template6 combine the include before evaluating arguments?
Nemokosch oh I think I get why it doesn't throw 21:59
the code is like if $stash.get('foo') { ... } 22:00
that's perfectly legit
and the default behavior for get is...
rf Hmm, I think if the stash doesn't have it, it should be falsy
Nemokosch > # If nothing was found, and we're not in strict mode, we return the original query. 22:01
rf Oh, should I be in strict?
Nemokosch I don't quite get the relevance of this non-strict mode that it's even the default
rf I think that should be refactored, but I am using a hack until then lol %args<toast> = Nil without %args<toast>;
Nemokosch but it seems like an easy fix to make the generated code $stash.get('foo', :strict)
why would somebody want `if the string I give you is truthy' as a default 22:02
rf I mean like if I do [% if foo %] and I did not pass foo, I expect it to evaluate to false 22:03
and not show what is within that
Nemokosch so far, it worked like, if foo gets interpreted as a bare string xD
but like not a single clue why anybody would have wanted that behavior 22:04
rf Yeah that is not very nice. 22:06
Nemokosch I think it should rather be the opposite - only fall back to a bare string interpretation under special circumstances - if at all 22:07
tonyo ohh, rf - protone was changed so that whatever you wrote in `{{...}}` made it's way into the resulting sub as just raw raku code 22:08
rf Hmm how does protone handle if statements? Would it just be {{ if foo { }} {{ } }} ? for ending 22:11
tonyo so you could end up doing stuff like `my $ctx = Protone::Context; $ctx.compile('tmpl', :code('{{ for %ctx<a> -> $b { do-something($b); } }}'); sub handle() { sub do-something($a) { say $a; }; $ctx.run('tmpl', :a((1,2,3,4))); # --> 1234`
Nemokosch my WSL keeps dying for whatever godforsaken reason now
tonyo i have a newer version i'll upload in a bit
rf @Nemokosch, I would only fallback if its surrounded by single quotes or something 22:12
Nemokosch yeah well I wouldn't even call that situation a fallback but it's closer to the right thing than the current state 22:14
I'm finally in.. 22:38
rf: hotfix coming soon for the if anomaly; will need a more elaborate solution in the long run 22:45
rf Sounds good, thanks! 22:46
xinming m: sub a {"a".say;}; my &oa := &a; a.wrap({"b".say;}); oa(); 23:36
camelia a
No such method 'wrap' for invocant of type 'Bool'. Did you mean any of
these: 'Map', 'Rat', 'WHAT', 'grep', 'map'?
in block <unit> at <tmp> line 1
xinming m: sub a {"a".say;}; my &oa := &a; &a.wrap({"b".say;}); oa(); a();
camelia b
b
xinming tonyo: It doesn't seem to be able to do what I meant. 23:37
&oa ref to the wrapped &a.
What I mean is outside the sub, we keep the &a ref somewhere before wrap, after wrap, a calls the wrapped version, But we may still need a way to call the unwrapped version somewhere. 23:38
cfa xinming: irclogs.raku.org/raku/2023-03-02.html#02:26 23:51
m: sub a { "a".say; }; my &a-old = &a.clone; &a.wrap({ "b".say }); a-old;
camelia a
cfa m: sub a { "a".say; }; my &a-old = &a.clone; &a.wrap({ "b".say }); a-old; a;
camelia a
b
xinming cfa: I mean without use the .clone method. ;-)