🦋 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.
00:00 reportable6 left 00:02 reportable6 joined 00:35 jpn joined 00:36 derpydoo joined 00:40 jpn left 01:40 squashable6 left, greppable6 left, notable6 left, reportable6 left, unicodable6 left, benchable6 left, committable6 left, quotable6 left, bisectable6 left, bloatable6 left, sourceable6 left, releasable6 left, shareable6 left, bloatable6 joined, notable6 joined, reportable6 joined 01:41 squashable6 joined, unicodable6 joined, quotable6 joined, committable6 joined, releasable6 joined 01:42 sourceable6 joined, greppable6 joined, bisectable6 joined, benchable6 joined 01:43 shareable6 joined 02:20 teatwo left, teatwo joined 03:08 kst joined 03:40 Poohmaan joined
Poohmaan Hello all 03:41
reduce &add, 50, |1..10
How can we write it in the form 1..10.reduce(-> $a & add, 30, $a) or something similar 03:42
Where sub add($a, $b) {return $a+$b} 03:43
The first syntax works and gives me 85 with 30 as the initial value 03:44
03:45 Poohmaan left
tonyo m: say [+] 50,|(1..100); # Poohmaan 03:47
camelia 5100
tellable6 2023-06-03T17:08:55Z #raku <uzl[m]> tonyo Minor PR for adding Rakudoc: github.com/tony-o/perl6-csv-parser/pull/22
tonyo will take a look in the morning uzl[m]
04:45 linkable6 left, evalable6 left, linkable6 joined 04:48 evalable6 joined
SmokeMachine If someone got interested in my last idea, I just created a repo with that (github.com/FCO/RakuAST-Matcher). Still very early stages. I'd love to have some more critics and advices from people with more experience with RakuAST (lizmat ?). And I'd like to know if someone thinks something like that would be useful/make sense... Thank you! 04:52
Voldenet impressive but can't `visit` method on RakuAST::Node be used for this matching? 05:06
this one github.com/rakudo/rakudo/blob/main...kumod#L181 05:07
perhaps it'd save you from implementing match method for every node type 05:10
05:20 jpn joined 05:24 jpn left 05:36 Xliff joined
Xliff Is there a raku equivalent for Python's accumulate? 05:39
Voldenet Xliff: .produce 05:44
Xliff Voldenet++ 05:54
Hmmm.... repl.it doesn't have it. 05:55
Oh good lord! 2021.07! 05:56
Um... not in 2023.05, either? 05:57
v6.3?
v6.e, even?
06:00 reportable6 left 06:03 reportable6 joined 06:17 Xliff left, RonaldR34g4m left 06:18 Vyrus joined 07:00 jpn joined 07:05 linkable6 left 07:08 linkable6 joined 07:26 jpn left 07:29 jpn joined 07:33 merp left, merp joined 07:35 jpn left 07:38 jpn joined 07:44 sena_kun joined 07:51 sena_kun left 08:06 xinming left 08:08 xinming joined 08:10 jpn left 08:23 codesections joined 08:42 codesections1 joined 08:44 codesections left, codesections1 is now known as codesections 08:58 jpn joined 09:14 jpn left 09:18 jpn joined 09:43 Sgeo left 09:58 codesections1 joined 10:00 codesections left, codesections1 is now known as codesections 10:19 sarna left 10:21 sarna joined 10:23 Xliff joined
Xliff \o 10:23
Does anyone have any clue as to how well NativeCall supports C++? I'm more worried about symbol mangling than anything else. 10:24
How well would a C++ class translate to Raku?
10:24 sarna left 10:25 sarna joined
moritz afaic symbol manging is compiler specific 10:32
so you'd have to ask "how well does nativecall support c++ compiled with $specific-compiler" 10:33
Xliff And that would be gcc 10:39
Or "whatever the Linux version of UE5 is compiled with" 10:40
10:40 euandreh joined
Xliff moritz: I guess a better question would be: How do I write NativeCall sub definitions for C++ method calls? 10:43
Especially constructors and destructors...
10:45 jpn left 10:47 squashable6 left 10:49 squashable6 joined 10:58 Xliff left 11:00 zara joined 11:07 derpydoo left 11:10 jpn joined 11:13 sarna left, sarna joined 11:15 Xliff joined 11:17 Xliff left 11:41 codesections left 11:50 jpn left 11:58 jpn joined 12:00 reportable6 left, reportable6 joined 12:13 codesections joined 12:27 jpn left 12:30 sena_kun joined 13:09 jpn joined 13:13 jpn left 13:28 discord-raku-bot left, discord-raku-bot joined 13:39 discord-raku-bot left, discord-raku-bot joined 13:46 codesections left
SmokeMachine Voldenet: do you mean using visit instead of the multiple match methods? 13:55
13:56 discord-raku-bot left, discord-raku-bot joined 14:04 codesections joined 14:08 jpn joined 14:14 jpn left 14:21 tea3po joined 14:22 tea3po left, tea3po joined 14:24 teatwo left 14:35 zara left 15:13 tea3po left 15:14 tea3po joined 15:18 swaggboi left 15:24 tea3po left, tea3po joined 15:37 swaggboi joined 16:37 evalable6 left, linkable6 left 16:38 linkable6 joined 16:40 evalable6 joined 16:43 codesections left, jpn joined 16:48 jpn left 17:01 Xliff joined
Xliff \o 17:01
SmokeMachine: Why not use .find-nodes?
m: use experimental :rakuast; my $ast = q«my $a = 42; say $a; class A { has $.a; method a ($a, $b) { say $a + $b }; }; ».AST; $ast.find-nodes( RakuAST::Var::Lexical, condition => *.name.substr(1) eq "b" ).gist.say 17:02
camelia (RakuAST::Var::Lexical.new("\$b"))
SmokeMachine Xliff: I think that’s harder than doing `ast-matcher(“$b”).search: $ast` 17:04
Xliff: but you could also use find-nodes like: $ast.find-nodes: RakuAST::Node, :condition{ match ‘$b’, $_ }`… in theory 17:09
Xliff: but my plan is to make it like a “grammar” for ast
Xliff SmokeMachine: So you want to make a more concise interface for it? 17:11
I've looked at the code, you look to be reinventing the wheel with all of the match methods.
Also, you are using a results object named Match, which will get confused with the regex Match. You might want to consider a name less prone to confusion. 17:12
SmokeMachine Xliff: I probably am… I just tried to write it in a easy way as a PoC. 17:13
Xliff Fair enough! Good luck!
SmokeMachine They are called RakuAST::Match, but yes… it may be better to rename it… any suggestion? 17:14
Xliff That's unique enough.
RakuAST::Match !~~ Match 17:15
You might want to make it RakuASTMatch
Just so there's no conflict with the shortname. You might get P6M errors otherwise.
SmokeMachine That makes sense, and also because that’s NOT a RakuAST node… 17:16
Xliff Yup.
SmokeMachine I’m planning to suggest lizmat to add something like that to rak to make it able to search by ast nodes… so, one could do: `rak <parameters> ‘my-func(1, ANYTHING)’` and that would search all files that calls function ‘my-func’ passing as arguments: 1 and anything. And that would not need to handle different formats… 17:21
Xliff ^^
(But it still needs a lot of work to be useful for anything…) 17:22
17:27 n1to joined, n1to left 17:43 jpn joined
Xliff SmokeMachine: Why would rak need such a thing? 17:44
I am just wondering about a real-life use case is all. 17:45
At any rate, I have to take a nap. BBIAB
SmokeMachine I keep doing stuff like: rak ‘/sub\s+my-func/ 17:51
It would be great to do that like: rak ‘sub my-func (ANYTHING) {ANYTHING}’ to find implementation of &my-func 17:52
18:00 reportable6 left, derpydoo joined 18:01 reportable6 joined 18:21 jpn left 18:58 jpn joined 18:59 Sgeo joined 19:07 codesections joined
leont Xliff: yeah name mangling is not very portable, but in practice there are only two variants that matter (gcc and msvc) 19:23
19:45 jpn left 19:53 euandreh left 19:58 euandreh joined 20:58 evalable6 left 20:59 evalable6 joined 21:02 codesections left
Xliff OMGIBLOGED! - gist.github.com/Xliff/c6e5b7fb9fe5...9d2c7312ee 21:11
weekly, gist.github.com/Xliff/c6e5b7fb9fe5...9d2c7312ee
weekly: gist.github.com/Xliff/c6e5b7fb9fe5...9d2c7312ee 21:12
notable6 Xliff, Noted! (weekly)
21:32 derpydoo left 21:33 Xliff left 21:50 sena_kun left 22:24 deoac joined 22:35 jpn joined 22:40 jpn left 22:55 TieUpYourCamel left 23:09 TieUpYourCamel joined 23:14 euandreh left 23:16 derpydoo joined 23:20 euandreh joined 23:31 euandreh left 23:39 euandreh joined