00:00
Chanakan joined
|
|||
antononcube | This is impressive: | 00:14 | |
cdn.discordapp.com/attachments/633...cb33d& | |||
@lucs See above. The link is correct. | 00:16 | ||
scullucs | It does answer my question, as asked. | 00:52 | |
01:37
hulk joined
01:38
Xliff joined
|
|||
Xliff | \o | 01:38 | |
01:38
kylese left
|
|||
Xliff | If I want to establish default values of a hash in another hash. What's the best way to merge the two? | 01:39 | |
antononcube | @Xliff I use merge-hash of "Hash::Merge", but some people might disagree. | 01:43 | |
The mainstream way is to use junction: my %h = %default , %new; | 01:44 | ||
timo | that's not a junction | 01:46 | |
antononcube | Fine, "just a comma", then. | ||
Xliff | What about if there are duplicates between %default and %new? | 01:47 | |
antononcube | %new replaces the keys found in %default. | 01:48 | |
[Coke] | m: my %default = 1,2,3,4; my %new = 3,5; my %h = %default, %new; dd %h | 01:49 | |
camelia | {"1" => 2, "3" => 5} | ||
antononcube | I find the comma joining of hashes too capricious, so, I prefer to use "Hash::Merge", which very light-weight. | 01:50 | |
timo | m: my %one = 1,2, 3,4, 5,6; my %two = 1,"hi", 5, "bye"; my %result; %result.push(%one); %result.push(%two); dd %result | 01:57 | |
camelia | {"1" => $[2, "hi"], "3" => 4, "5" => $[6, "bye"]} | ||
timo | probably not what you want, just a fun thing | 02:03 | |
02:15
hulk left,
kylese joined
02:44
Aedil joined
04:27
xinming joined
04:46
xinming left
04:49
xinming joined
04:54
cm_ joined,
cm left,
cm_ is now known as cm
|
|||
Xliff | How can you import a packages symbols into the current scope at runtime? | 05:18 | |
I know you can try require, but that only loads the compunit. That doesn't perform the import operation, correct? | |||
timo | the runtime import thing has the limitation that the compiler can't know what's going to be imported, so you wouldn't get any symbols. there's a variant where you have to tell it the symbols that you want ahead of time, but i forgor | 05:34 | |
ugexe | m: require Test <&ok>; ok(1) | 05:36 | |
camelia | ok 1 - | ||
06:10
abraxxa-home joined
06:12
abraxxa-home left
06:14
abraxxa-home joined
06:32
human-blip joined
08:32
Sgeo left
08:51
stanrifkin joined
09:25
sena_kun joined
10:03
antim0d3s left,
antim0d3s joined
10:27
camelia left,
camelia joined
|
|||
antononcube | @Xliff I assume you do not know the subs / symbols provided by the package you will load at runtime? | 12:19 | |
12:23
merp left
|
|||
I suspect something like this would work: my $pName = “MyPackage”; my $subName = “better-sub”; say “MyPackage::{$subName}”(); | 12:23 | ||
There might be some other arrangement of “::”, “.”, etc. that is required… | 12:24 | ||
14:58
vrurg_ joined,
vrurg left
|
|||
Xliff | Thanks, anton. | 15:22 | |
15:29
stanrifkin left
|
|||
SmokeMachine | Hi!jI'm back playing with RakuAST matchers... I'm writing a way to create a ASTQuery, and that's how it's looking: usercontent.irccloud-cdn.com/file/.../image.png | 15:53 | |
does that make any sense? | 15:54 | ||
`ast-query call, "say"` mean: match a RakuAST::Call where `name` is `eqv` to RakuAST::Name.from-identifier("say") | 15:56 | ||
ab5tract | SmokeMachine: very cool! | 15:57 | |
SmokeMachine | `ast-query conditional` mean: match a mode that is any of: RakuAST::Statement::IfWith or RakuAST::Statement::Unless | ||
and `ast-query [ ast-query 42 ]` mean: match a node that has a child that `eqv` to RakuAST::IntLiteral.new(42) | 16:00 | ||
it's still very early development... but I'd like to know if anyone have any opinion/advice... | 16:02 | ||
I was thinking that instead of `ast-query [ ast-query 42 ]` it could be something like `ast-query :children[ ast-query 42 ]`... but I plan to use pairs to search into specific | 16:04 | ||
librasteve | SmokeMachine: holy crap - that's cool! | ||
SmokeMachine | *specific attributes of the node... | 16:05 | |
librasteve | reminds me of JQuery (a bit) | ||
SmokeMachine | :) | 16:06 | |
librasteve: is that a good thing? :) | 16:07 | ||
if curious, here is the code: github.com/FCO/ASTQuery | 16:12 | ||
Any idea where to go with that? | 16:19 | ||
Idea/suggestion | |||
Or even better ways of doing that (code wise, I mean) | 16:20 | ||
I don’t think the way my code works is the best way of doing that… but it was the way I was able to make that work at the time… so if someone have any suggestions to improve that, please let me know | 16:22 | ||
antononcube | @SmokeMachine Reminds of XPath for XML. If that is similar in spirit, then "obvious" suggestion can come from that analogy. | 16:46 | |
I.e. operations or functionalities of XPath should be considered for replication / reflection in ast-query. | 16:48 | ||
SmokeMachine | Idk if that’s similar to xpath. If I remember it well, with xpath you need to indicate a path to your node (even if you add some jumps on that). ast-path returns an object that has a ACCEPTS method for ast nodes (speaking on that, could all RakuAST have a common parent class?) | 16:52 | |
antononcube: 👆 | 16:53 | ||
antononcube | @SmokeMachine Ok, it seems, your endevour on this too esoteric for me to comment. | 16:58 | |
SmokeMachine | :( | 16:59 | |
lizmat | SmokeMachine: *not* all RakuAST classes inherit from RakuAST::Node | 17:00 | |
but I think all that really matter, do | |||
antononcube | @SmokeMachine It would help if to know: 1. Who is the consumer/user of this functionality? 2. Why is it useful? 3. What are the most likely workflows with it? 4. Can LLMs be used instead? 5. If yes, what would be corresponding LLM prompts? | 17:01 | |
Basically, 5 can be used for both as an alternative implementation and as way to generate a prototype. | 17:03 | ||
Better, fuller descriptions and use case examples can, of course, be used to generate ideas for other related functionalities. | 17:05 | ||
SmokeMachine | lizmat: yes, I saw that… why not? | 17:06 | |
lizmat | implementation details really | ||
sometimes inheritance from RakuAST::Node was annoying | 17:07 | ||
there's only 2 or 3 of them, if I remember correctly | 17:08 | ||
SmokeMachine | antononcube: 1. Anyone that wants to find/search/modify ast; 2. It (tries) to make it simple and declarative how to search nodes into ast; 3. I plan using it to find and replace nodes on user’s ast when they are using my module (probably the first module using it will be Red); 4. I don’t see how (but I could be wrong; 5. Not applicable | 17:12 | |
lizmat: none of the ones I played with did… but couldn’t, for example, all of them inhericance from something like RakuAST that don’t do anything, and is only a way to rever to every “node”? | 17:14 | ||
Another thing I see is that we have a IfWith that is parent of if and with (because of the implementation) and an Unless that is not related to that… on my ASTQuery, I have a ‘conditional’ that represents IfWith AND Unless… would that make sense to group this kind of sets on class hierarchy? | 17:17 | ||
lizmat: 👆 | 17:18 | ||
lizmat | will respond after dinner& | 17:24 | |
SmokeMachine | Thanks! 👍 | 17:29 | |
librasteve | SmokeMachine: on JQuery, I think that it (and CSS) are a good general model for query selectors ... it felt a little that you are going that way ... and now I said it I think that ASTValue would be like ID# and also you would want class. and maybe children, child(N), append, delete ... no pressure ! ;-) | 17:36 | |
@antononcube I would expect LLM to be genius at this - here is a block of AST, please transform this to that kind of prompt flow | 17:40 | ||
SmokeMachine | librasteve: while I was researching about ast queries to strat writing this project, I found this that looks a lot like what you are saying: prataprc.github.io/astquery.io/ | ||
(At the end of the page, there is a full list of selectors that gives a better idea of how to use that) | 17:42 | ||
librasteve | here's an example - let's say I want to implement a raku Slang, eg. Roman 0rIIII, 4, q{Roman numeral 4}; then how can I pick all out these literals and systematically convert to Ints within the RakuAST | 17:44 | |
SmokeMachine | The, the `ast-query call, “say”` could become: `ast-query “.call[name=say]”. That looks good… | 17:45 | |
librasteve | Smoke: yep - that's the thought I had - not surprised that there is prior art for AST | ||
you can write a Grammar for you AST query language | |||
SmokeMachine | I kinda like the “.call[name=say]”… but maybe even better: “.call#say” | 17:46 | |
librasteve | me, I would take inspiration from the Go parser in the page you referenced - I am a sucker for square brackets | 17:50 | |
SmokeMachine | But I’m a bit in doubt about, for example, getting the first numeric argument of a say call: “.call#say .int” but that you’ll get any int inside the say call… lit the 42 in `say “bla” x 42`, right? | 17:51 | |
lizmat | SmokeMachine: are you aware of github.com/rakudo/rakudo/blob/main...od#L29-L42 | 17:54 | |
? | |||
librasteve | not sure if that allows updates/insertions though, chatgpt.com/share/671543d7-b9b8-80...fee9536fca | ||
^^ btw I would be very happy with a very small but sufficient subset of this prior art | 17:56 | ||
Fixups .oO | 17:57 | ||
lizmat | the Fixups file is for RakuAST stuff that is not needed to build Rakudo | ||
so we don't have to write that in NQP | |||
18:13
sena_kun left
|
|||
SmokeMachine | lizmat: do you mean we could add there some parents? I don’t think I got what you meant… :( | 18:13 | |
18:26
sena_kun joined
18:57
Aedil left,
Chanakan left
18:59
stanrifkin joined
|
|||
antononcube | @SmokeMachine & @librasteve Sorry, I was / am in meetings. I will respond later today/tonight. | 19:08 | |
holmdunc | Tree-Sitter's query system tree-sitter.github.io/tree-sitter/...th-queries is probably a more analogous than jQuery/XPath. And it's in use in many editors (Neovim, Emacs, Zed, ...) right now! | 19:13 | |
librasteve | holmdunc: looks cool (a bit too verbose in the function names) | 19:15 | |
imo | |||
SmokeMachine | I started my research with treesiter… but because it’s ast is for string manipulation only, I didn’t think it would be a good match | 19:19 | |
holmdunc | Yeah, didn't mean you should use TS because that would involve writing an epic TS grammar for Raku in the first place. BTW librasteve all those names are chosen by whoever writes the TS grammar for each particular language | 19:23 | |
librasteve | SmokeMachine: no need to reply to me - I am just chucking some thoughts over the fence | ||
SmokeMachine | I’d like to continue the subject… every help is needed… | 19:31 | |
librasteve | great | 19:32 | |
SmokeMachine | I think I’ll try that css selector way when I have some time… | 19:37 | |
20:16
stanrifkin left
|
|||
antononcube | Mathematica / Wolfram Language does (hierarchical) matching / querying using M-expressions. | 20:29 | |
(Similar to the S-expressions query DSL of Tree-sitter.) | 20:30 | ||
@SmokeMachine From the discussion I read so far, it seems that LLMs can be applied in several ways: (i) for alternative implementation(s), (ii) for translating natural language queries into specific DSL queries, (iii) to generate implementation code, (iv) to compare, teach, or explain what the AST query system(s) do. | 20:35 | ||
@holmdunc What would be the benefits to have "an epic TS grammar" for Raku? After scanning the reference you profided, I was thinking the other way around -- emulating Tree-Sitter (TS) functionalities in Raku. | 20:44 | ||
(And it seems that I would rather emulate those of WL than those of TS...) | 20:45 | ||
SmokeMachine | Having a TS grammar for Raku would help me a lot… every time editing Raku code on my nvim I need to `sun off` because for some reason the highlight is so slow that it can breaks my nvim… | 20:51 | |
Having a treesiter gramar would probably help on that | |||
antononcube | So, the TS grammar for Raku is to help using Raku in other systems, e.g., editors or IDEs? | 20:53 | |
SmokeMachine | Talking about that: is anyone else getting problems with nvim’s Raku syntax highlighting? | ||
Antononcube: yes | |||
librasteve | I recommend the IntelliJ Comma plugin | 20:55 | |
SmokeMachine | No, thanks… nvim is my editor… | ||
antononcube | It probably not hard to convert DrForr's Raku parser into a TS parser. Or write one that scratch. | 20:56 | |
SmokeMachine | I prefer using vim/nvim without syntax highlighting than using anything else | ||
librasteve | (yeah - sorry - I rawdog vi about 50% of time - once upon a time I thought the future of raku IDE would be to bring up TS and then embed in the IntelliJ TS plugin among other distis) | 20:57 | |
but ab5tract saved me from this fate | 20:59 | ||
holmdunc | @antononcube My characterisation of the fictitious TS grammar for Raku as "epic" was about the level of effort I imagine would be needed to make it comprehensive/correct 🙂 In practice, that is what differentiates the new TS-based approaches to syntax highlighting and structural editing in e.g. vim/emacs from their legacy approaches: Actually being comprehensive/correct and not just best-effort | 21:11 | |
antononcube | Good to know. 1. Can a TS grammar have an MVP version that is gradually changed into an "epic" one? 2. Or only epic/complete versions are allowed? 3. What is the preferred language for a TS grammar implementation of Raku: C, JavaScript, or something else? | 21:14 | |
SmokeMachine | antononcube: 1. I think it can; 2. I don’t think so; 3. A flavour of us that’s transpired to c (if I’m not mistaken) | 21:21 | |
21:22
sena_kun left
|
|||
SmokeMachine | tree-sitter.github.io/tree-sitter/...ng-parsers | 21:22 | |
21:22
sena_kun joined
|
|||
holmdunc | They're written in a constrained form of JavaScript, optionally with a bit of C on the side, and compiled down into a shared library. All I'm mentioning is just my perception of the norms really. There's nothing stopping ones of any level of quality being distributed | 21:23 | |
antononcube | @holmdunc Can download and open this file? | 21:24 | |
cdn.discordapp.com/attachments/633...6c520& | |||
👆Made with OpenAI's "o1-mini". | 21:25 | ||
holmdunc | Hehe, I don't have the setup on this machine but no doubt an interesting avenue | 21:29 | |
21:43
zetaaaa joined
21:59
dextercd joined
22:22
abraxxa-home left
22:51
guifa joined
23:16
Heavy joined
|
|||
Heavy | bisectable: say Rat.new(1, 2**64).nude | 23:17 | |
bisectable6 | Heavy, Will bisect the whole range automagically because no endpoints were provided, hang tight | ||
Heavy, ¦6c (84 commits): «(1 18446744073709551616)» | |||
Heavy, Nothing to bisect! | |||
Heavy | hm, good to know | 23:19 | |
23:19
Heavy left
23:41
sena_kun left
|