🦋 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.
ben_m Hello, is there a way to overwrite an operator's associativity? I'm looking for the best way to do something like `[\+] <1 2 3> #=> (1 + 2 + 3, 2 + 3, 3)` without either defining a new + operator or reversing twice. 04:03
lizmat m: BEGIN trait_mod:<is>(&[+], :tighter(&[*])); say 1 + 3 * 4 # doesn't appear to work 10:12
camelia 13
librasteve m: sub infix:<+r>($a, $b) is assoc<right> { $a + $b }; say [+r] <1 2 3>; 12:31
evalable6 (exit code 1) 4===SORRY!4=== Er…
Raku eval (3 5 6)
evalable6 librasteve, Full output: gist.github.com/87c206e83baf2c5461...4b27b5cc4b
librasteve ben_m: this is close, but doesn't quite give what you asked for since the first result is the rightmost item 12:34
[oh and on the Discord bridge its dropping the backslash should be say [\+r] <1 2 3>; 12:36
]
lizmat PSA: raku.org and a bunch of other sites are currently offline, the infra team is investigating 13:17
antononcube Damn! Now we have only LLMs to rely upon for Raku inquiries... 13:21
andinus docs.raku.org/ is up currently 13:25
antononcube 💯 13:25
andinus Hmmm... that halts my LLM promotion. (For now...) 13:26
Xliff Hello! Does anyone here use Blender? 13:29
I'm interested in seeing if we can bring the Blender API to Raku.
antononcube Here is a conspiracy theory instead -- > A certain recent DDOS attack spilled over to raku.org. Maybe not completely by accident, some of the attackers might not like Raku. 13:30
Especially, after seeing attempts to use Blender from Raku. 13:31
lizmat antononcube I assume you use docs.raku.org mostly no? that's still online 13:35
antononcube Yes, it is -- I verified earlier. 13:40
lizmat yeah, that's hosted in Germany... seems we lost all servers hosted in Finlandd 13:41
ben_m librasteve: Interesting, I thought defining a new operator would work and I was trying to avoid doing that, but not even that gets the exact results. 13:59
[Coke] (finland) huh 14:07
antononcube Did Trump talk to Musk from Finland? Or the other way around? 14:09
lizmat PSA: a temporary server is being set up by the infra team 14:26
lizmat clickbaits rakudoweekly.blog/2024/08/12/2024-...6c-ending/ 15:45
[Coke] OK, I have failed as a father. one of the kids just unplugged the router and didn't warn anyone. 15:56
(while I was on a work zoom, even.)
Xliff <antononcube> Especially, after seeing attempts to use Blender from Raku. # Anton, was this a slight dig at the question I just asked? 16:02
lizmat raku.org is up again, andinus++ 16:06
as is rakudo.org 16:10
Xliff <antoncube> I think using IPC via protlib (courtwright.org/protlib/) would work. 16:25
We'd need a wire->python->blender bridge and a raku->wire bridge 16:26
Bonus points for a python->wire bridge
Think about it like this: Blender networked renderers taking orders from a central blender server for Renders. 16:27
antononcube @Xliff I think we discussed this before -- I remember looking at Python's API for Blender, and proposing to feed it to an LLM, or five. 16:51
Xliff Heh! OK! 17:00
guifa Can I safely pass %?RESOURCES<foo>.absolute to a native call to read a file? I know file names get mangled when installed by zef 22:38
ab5tract guifa: you might be able to get the actual file descriptor by poking at the object with nqp 22:49
(after calling IO on it)
guifa it's a load once thing so passing an absolute path is good enough (plus the Obj-C method I'm calling wants a path) 22:50
ab5tract Have to say that I don’t totally love the difficulty of interacting with resources
For some reason I have this feeling that .absolute was removed recently.. 22:51
But if you can .absolute.IO.open then I would expect the path to be sufficient for native call as well 22:52
guifa I'm almost ready to show off my little canvas-y project, at least an extreme basic version of it 23:05
ugexe yeah you generally should not expect things to have a path to the file system, see github.com/ugexe/Raku-CompUnit--Re...ry--Github 23:06
technically you are probably ok getting the path off of %?RESOURCES although we don't actually support doing that for the reason I mentioned
ugexe what I've usually done is copy a file from %?RESOURCES to a known file system location, and then use that file path 23:07
guifa is there a good cross-platform temp file location to use? 23:08
ugexe i use $*TMPDIR.add('my-app')
guifa aaaaaah totally did not realize there was a $*TMPDIR 23:09
so copy on a Distribution::Resource would be considered safe?, e.g., `copy %?RESOURCES<foo>, $*TMPDIR.add('foo')` 23:11
ugexe my $source = %?RESOURCES<foo>.slurp; $*HOME.add('my-app').spurt($source); # is how i would do it 23:14
evalable6 Use of uninitialized value $source of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
in block <unit> at /tmp/MQNfo3M10A line 1
ugexe which also note i use $*HOME instead of $*TMPDIR usually
github.com/sergot/openssl/blob/fd6...akumod#L34 (although here is an actual example where i used $*TMPDIR so 🤷) 23:17
guifa alright noted 23:18
actually while we're on it 23:30
what's the safest way to call an included library? I seem to recall we've had both /bin and /resources/library (or was it libraries) 23:34
but my search foo failed miserably on docs.raku
right now I'm doing Proc::Async(%?RESOURCES<foo>) but I'm willing to bet 100 that's not an ideal method 23:35
ah it's in the nativecall not the modules one 23:38
right now I'm using the stdin/stdout to pass messages, I guess if I switch to proper native call I'll need to pass in a pipe 23:42
assuming obj-c .so works with NativeCall 23:43
tbrowder note when slurping and spurting you should add :bin if you have problems 23:51
lizmat: in yr getting rid of the old p6c stuff have you gotten to CompUnit::Util yet? it still has a bug that messes up installing Archive::SimpleZip 23:55