01:02
Manifest0 left
01:23
ryoskzypu left
01:24
ryoskzypu joined
01:36
ryoskzypu left,
ryoskzypu joined
01:41
nil78 left
01:47
nil78 joined
02:59
hulk joined,
kylese left
03:06
mtj joined
03:15
hulk left,
kylese joined
04:15
wbooze joined
04:39
jpn joined
04:43
jpn left
05:03
wbooze left
05:19
wbooze joined
05:37
Aedil joined
06:10
Aedil left
06:27
Aedil joined
07:26
silug left
07:53
silug joined
08:25
ACfromTX left
08:33
Sgeo left
08:39
Manifest0 joined
08:49
jpn joined
09:01
jpn left
09:12
jpn joined
09:13
ACfromTX joined,
dakkar joined,
wayland76 joined
|
|||
wayland76 | Hi all! | 09:14 | |
09:17
jpn left
09:25
jpn joined
|
|||
librasteve | good morning | 09:35 | |
wayland76 | I'm trying to implement a bunch of operators that will allow us to walk trees like XPath. I've seen the .tree function (not well documented). I think I'm going to have to make some custom iterators for them. At the moment, I'm just trying to get .tree() to output each element separately instead of as an array. | 09:39 | |
m: <c b a>.tree(*.self.say) | 09:40 | ||
camelia | (c b a) | ||
wayland76 | What am I doing wrong? | ||
m: <c b a>.tree(*.say) | 09:41 | ||
camelia | (c b a) | ||
wayland76 | Actually, I've figure I was getting over-fancy. But I'm still going to want something that walks a tree and just selects the nodes that match a function (like grep, but walks a tree). Any tips? | 09:47 | |
09:57
sena_kun joined
10:09
wbooze left
|
|||
antononcube | Look at Cases of Wolfram Language: reference.wolfram.com/language/ref/Cases.html | 10:10 | |
I strongly suspect that RakuAST is the best way to do this. Also, there are recent discussions here about similar functionalities. | 10:18 | ||
See / search discussions around “tree-sitter”. | 10:21 | ||
10:27
sena_kun left
|
|||
wayland76 | antoncube: Interesting! The Wolfram one I'm assuming was for inspiration. The RakuAST stuff looks interesting, but I'm trying to a) make something that'll work at least somewhat on any nested data structure (which I'm not sure the RakuAST stuff does), and b) will call a "parent" method if available, to allow walking up the tree, or sideways, or whatever. | 10:32 | |
Anyway, I've got my operators for child, descendent, and self working, so I'll stop for the night (9:33pm here). I think the next step will be to have it match against a LibXML document. | 10:34 | ||
I'm hoping to have operators that do most of the tree walking that XPath axes can do (parent, ancestor, following-sibling, etc). | 10:35 | ||
10:35
wbooze joined
|
|||
lizmat | tbrowder: re Data::Dump::Tree github.com/nkh/P6-Data-Dump-Tree/i...2668321046 | 11:14 | |
tbrowder | lizmat: thnx | 11:39 | |
m: say "\x[120]"; say "\c[100]" | 11:40 | ||
camelia | Ġ d |
||
tbrowder | m: say "\o[200]" | 11:41 | |
camelia | |||
tbrowder | is there any way to use an octal number in the string to get a char? | 11:42 | |
i know you can in a pod string | |||
postscript uses \nnn inside the string as a char refererenc, but i don't think that would work | 11:44 | ||
m: say "\O[200]" | 11:45 | ||
camelia | ===SORRY!=== Error while compiling <tmp> Unrecognized backslash sequence: '\O' at <tmp>:1 ------> say "\<HERE>O[200]" expecting any of: argument list double quotes term |
||
lizmat | m: say "\o[101]" | ||
camelia | A | 11:46 | |
lizmat | m: say "\o101" | ||
camelia | A | ||
lizmat | looks to me \o does what you want ? | ||
m: say 0o101 | 11:47 | ||
camelia | 65 | ||
lizmat | m: say 0o101.chr | ||
camelia | A | ||
tbrowder | yes, i'm no sure that's in the docs. the two hex and dec forms are together | ||
lizmat | if it's not in the docs, it should be :) | ||
tbrowder | yes, for sure | 11:48 | |
thank you! it makes my old redbook very useful again | 11:49 | ||
m: say "0d10" | 11:51 | ||
camelia | 0d10 | ||
tbrowder | m: say 0d10 | 11:52 | |
camelia | 10 | ||
tbrowder | m: say 0o101 | ||
camelia | 65 | ||
13:21
wbooze left
13:31
melezhik joined
|
|||
melezhik | . | 13:31 | |
weekly: sparrowdo.wordpress.com/2025/02/19...sparrowdo/ | |||
notable6 | melezhik, Noted! (weekly) | ||
13:35
melezhik left
13:49
topnep left
13:52
topnep joined,
topnep left
13:55
topnep joined
14:05
jpn left
14:09
jpn joined
14:12
apac joined
|
|||
tbrowder | i just submitted a docs PR | 14:35 | |
14:39
euandreh joined
14:51
ryoskzypu left
14:53
ryoskzypu joined
15:25
euandreh1 joined
15:27
euandreh left,
euandreh1 is now known as euandreh
15:29
Aedil left
15:43
Aedil joined
16:10
Guest45 joined
16:11
Guest45 left
16:25
dawids_ joined
|
|||
librasteve | wayland76: sorry went out for a bit, how about | 16:38 | |
m: say [[1,2,3],[[4,5],6,7]].deepmap({$_ %% 2 ?? $_ !! Empty}); | |||
evalable6 | [[2] [[4] 6]] | ||
Raku eval | [[2] [[4] 6]] | ||
librasteve | (or duckmap) | 16:39 | |
? | |||
17:08
silug left
17:11
dawids_ left,
silug joined
17:13
Mrtophat joined
|
|||
timo | is there something convenient that's like "zef look" but instead of extracting a release it "git clone"s a distro's source repo to a folder on my disk? | 17:15 | |
17:16
Mrtophat left
|
|||
melezhik. | timo: I am recalling I did some automation , but not exactly what you are asking , if you just need a source code from tarball you may use this - sparrowhub.io/plugin/zef-fetch/0.001000 | 17:24 | |
Maybe I can adjust it a bit and return scm repo via state as well, as long as it is valid in META6.json file | 17:26 | ||
You can try out passing identity as a git repo and see what it does , I am not however sure that git scm is a valid zef identity | 17:27 | ||
timo | yeah i only want to clone the repo, only the latest - or specified - version that was released does not help me at all for what i want to do | 17:29 | |
melezhik. | I just checked zef docs , so identity could be an scm repo , so you could do this “my $state = task-run ‘fetch thing’, ‘zef-fetch’, %( identity => ‘module git repo’); say $state<directory>;” | 17:32 | |
Does what you need to do | 17:33 | ||
But you need to know scm repo | |||
Or actually just - git clone repo , I dunno 🤷)) | 17:34 | ||
17:35
dakkar left
|
|||
timo | yeah if i already have the scm url i don't need to do anything with zef. except the whole point is i don't want to find or type out the repo url, i want to have only the short-name of the distro and get a clone in a predictable place | 17:37 | |
i want to "hack-on Zef" and it would do something like `mkdir -p ~/raku/ecosystem/ugexe/github/zef/`, git clone zef in there, and optionally cd me into it | 17:38 | ||
17:41
silug left
17:42
silug joined
|
|||
ugexe | i usually do `zef look Foo::bar` although that isn't quite what you asked for since it will download tar.gz files and not put it in a predicable place (it goes in some temp dir i think) | 17:44 | |
you can do e.g. `zef browse zef source --/open` but that only works if they link the repo url in the support.source field of the metadata | |||
(`zef browse zef source --/open` would output the repo to fetch to be clear - you'd still need to pipe it to git to actually fetch) | 17:45 | ||
also sorry i didnt look back far enough to see you already mentioned zef look | |||
timo | right | 17:46 | |
ugexe | i think `zef browse zef source --/open` fits the job, but most people probably dont fill out that field | ||
you can get rid of `--/open` and it'll open a browser window to the repo | 17:47 | ||
timo | in the case of JSON::Fast, zef browse JSON::Fast source --/open will give 'browse' urls supported by JSON::Fast: source because the url is a git:// and therefore the check for http or https fails and zef considers it "not what you want" | ||
is Zef::Client meant to be easy to use in a custom script or one-liner? what I ended up with now looks like `use Zef::Client; use Zef::Config; my $confpath = Zef::Config::guess-path; my $conf = Zef::Config::parse-file($confpath); my $c = Zef::Client.new(config => $conf); $c.search(...)` which is a little bit wordy and maybe the guess-path + parse-file case could get a shortcut somehow | 17:48 | ||
ugexe | i guess github.com/ugexe/zef/blob/080304e1...#L900-L903 should also not fire if --/open is specified | 17:50 | |
timo | i could imagine a `zef script` with optional `--repl` that pre-initialises a Zef::Client with all the bells and whistles from the commandline arguments that zef has | ||
or alternatively a `use Zef::Client::DWIM;` | |||
but i have no idea if anyone else has needs to script with zef, so it could be a waste of time, too | |||
ugexe | there needs to be a real Zef::Configuration class that contains the configuration and works with Zef::CLI and MAIN param config options and ENV options | 17:55 | |
but yeah ideally Zef::Client would require less verbosity to use without providing a DWIM class that isnt otherwise used by any of the other code in Zef | 17:56 | ||
18:01
dawids_ joined,
dawids_ left
18:04
apac left
|
|||
timo | right, if it's not used by Zef itself, it is likely to bit-rot without anybody noticing. test cases can only do so much if nobody shows up to write down all the implicit assumptions | 18:07 | |
18:09
apac joined
18:16
apac left
18:36
abraxxa-home joined
18:39
abraxxa-home left
18:41
sena_kun joined
18:47
jpn left
19:48
Aedil left
20:00
apac joined,
nil78 left
20:02
nil78 joined
20:14
topnep left
20:15
topnep joined
|
|||
wayland76 | librasteve: Interesting! deepmap looks useful, but I'm really looking for a deepgrep. | 20:33 | |
timo | you can use gather/take for that if you like | 20:57 | |
m: my @in = [[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]]]; dd deepmap-with-if => @in.deepmap({ $_ if .is-prime }), deepmap-with-gather-take => (do gather @in.deepmap({ take $_ if .is-prime })).list; | 20:59 | ||
camelia | :deepmap-with-gather-take((2, 3, 5, 7, 11)) :deepmap-with-if([[[2, 3], [5]], [[7], [11]]]) |
||
timo | depends on what you want, gather/take will give you a flat result, deepmap with if will keep the structure | ||
ah i see librasteve already showed how Empty can do that | 21:00 | ||
wayland76 | Nice! I'm after the flat structure. Thanks! | 21:01 | |
timo | i've never actually used ** aka HyperWhatever before, but i did not expect this: | 21:03 | |
m: dd [[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]]][**] | |||
camelia | (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Seq | ||
librasteve | .oO | ||
timo | but what i did expect, after seeing that, was for postcircumfix:<[]> with ** would also allow :kv and :p and friends | ||
librasteve | m: [[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]]].flat(:hammer).say | 21:05 | |
evalable6 | (1 2 3 4 5 6 7 8 9 10 11 12) | ||
Raku eval | ([[1 2 3] [4 5 6]] [[7 8 9] [10 11 12]]) | ||
timo | right, :hammer is also relatively new AFAIK | 21:06 | |
librasteve | yep - but I wonder if it plays nice with :kv | :p | 21:07 | |
timo | not sure flat is actually a place i'd expect those adverbs to apply | 21:09 | |
librasteve | not sure I understand what you meant with HyperWhatever playing nice with kv | p | 21:10 | |
guess I need an example | |||
timo | well, for the tree-ified numbers between 1 and 12 i was hoping for something like `(0,0,0) => 1, (0,0,1) => 2, (0,0,2) => 3, (0,1,0) => 4, ...` | 21:11 | |
21:16
silug left
|
|||
librasteve | well - can't help on that - but tx for introducing me to HyperWhatever ;-) | 21:16 | |
wayland76 | I have a question. I'm using the XML module by lizmat, and it says "Unless you are doing something that requires direct access of the @.nodes property, it's probably easier (and less noisy) to use the array access syntax.". However, at some point (when passing to a function), I get the error "Type check failed in binding to parameter '@inputs'; expected Positional but got XML::Element ((my \XML::Element_44...)" | ||
timo | it really feels like we should have an ecosystem module with an implementation of what i just described | 21:18 | |
wayland76: that sounds like passing a single element to a constructor's argument that would want an array (or similar) | |||
21:19
silug joined
|
|||
timo | what module is that exactly? i don't see one by liz in the ecosystems? | 21:21 | |
wayland76 | Sorry, it's a community module and GitHub has her name on it. | ||
raku.land/zef:raku-community-modules/XML | |||
github.com/raku-community-modules/...nt.rakumod | 21:22 | ||
timo | ah right, that's the last commit that changed the file | ||
i think what that message (comment?) you pasted is refering to is that you would use $my-element[3] for getting a node's fourth child node | 21:24 | ||
wayland76 | timo: agreed. However, I have some code that's testing for that, and I've been using $item ~~ Positional, but now I'm going to have to start testing for .can('AT-POS') or whatever. I'm of the opinion that XML::Element should also be marked "does Positional does Associative". | 21:26 | |
timo | oh, yes it makes sense that if it has these methods it should also do that role | 21:31 | |
librasteve | since a community module, maybe a PR would help? | 21:35 | |
21:35
apac left
|
|||
wayland76 | librasteve: Agreed; I hope to get to it, but for now, I've made an issue instead. | 21:36 | |
librasteve | ++ | 21:38 | |
also a lot of raku is kinda stubs for more work ... I would love to see clean and simple primitives for tree walking in a module that could ultimately become part of the core | 21:40 | ||
antononcube | I would love to see gcd on Rat’s. 🙂 | 21:47 | |
Doing that later today… | 21:48 | ||
librasteve | diy | ||
dont forget the gaussian complex no's | |||
wayland76 | Regarding a tree module, likewise. | 21:49 | |
If I get this done, it might be a step in the right direction; an inspiration/basis for the core tree-walking modules. It seems achievable at the moment, if I don't run into too many more bugs. | 22:00 | ||
Anyway, off to work. Good $time-of-day to you all :) | |||
22:05
wayland76 left
|
|||
antononcube | @librasteve I implemented the GCD for Gaussian integers already. It is needed to factorize Gaussian integers, (also implemented, now.) | 22:16 | |
22:19
topnep left
|
|||
timo | randomly responded to two of the XML github issues | 22:19 | |
22:20
topnep joined
|
|||
antononcube | It turns out that Perl has a comprehensive Number theory package. And -- surprise, surprise -- that Perl package follows and mentions Mathematica a lot and often. | 22:29 | |
I referring to "Math::Prime::Util::GMP". | 22:30 | ||
22:32
jpn joined
|
|||
timo | here's a question / concern / bike shedding oportunity about a page in the docs: github.com/Raku/doc/pull/4555#issu...2669915588 would be happy for some input | 22:36 | |
22:36
silug left,
silug joined
22:37
jpn left,
donaldh left
23:53
sena_kun left
|