2 Dec 2022
leont deepmap does recurse 00:00
atweiden-air_ leont: i think i get it. so .uc is being applied to each list, not to each list element? 00:02
leont Yeah. Map iterates over all elements of @a, which are lists, and calls .uc on them
atweiden-air_ makes sense 00:03
leont .uc and other stringy methods are defined on lists, and effectively do .Str.uc
tonyo .seen jjmerelo 00:56
tellable6 tonyo, I saw jjmerelo 2021-05-26T15:37:00Z in #raku: <jmerelo> No changes === good
tonyo wowza.
ToddAndMargo Windows 11 pro 22H2. 01:52
You guys have been helping me figure out NativeCall and Pointers.  I finally got it figured out.  I just posted an example over on the perl6 mailing list of use of pointers for calling Windows DLL's and for copying data out of structures when given a pointer to the structure.
I get a pointer and length from "GetComputerNameA" and then show how to use the pointers to copy the data pointed to with "memcpy_s".
pastebin.com/ni3J5hvD
Maybe someone would want to clean this up and post it in Raku's example section?
Thank you all for the help!
grondilu I was wondering: what's the point of the BEGIN phaser? I mean, shouldn't the compiler compile anything that it can anyway? 07:10
Nemokosch How do you define "what it can"? 08:44
I'm sure this is written down somewhere or we have talked about it - but how do array literals work? 09:20
[1] - this is a one-element array 09:21
[<a b c>] - this is a three-element array, despite the List inside
in fact, even [[1, 2]] "auto-flattens" 09:22
I know you can make it a scalar or add a comma, I'm just curious how this is processed
Geth advent: d5913364d3 | (Fernando Corrêa)++ | 2 files
Add RedFactory to the list of articles
09:40
advent: 4a1b3daf4f | (Fernando Correa de Oliveira)++ (committed using GitHub Web editor) | raku-advent-2022/articles/RedFactory.md
Update RedFactory.md
09:41
grondilu I may be wrong but it shouldn't be too hard to assess whether an expression can be compiled or not. For instance in my implementation of md5 (github.com/grondilu/libdigest-raku...t.rakumod) I have blobs and arrays defined in a BEGIN because they depend only on literals. It occurred to me later that the compiler could figure out by itself that these are constant arrays that could and ma 11:22
Nemokosch in that case, why don't you declare them as constants? 11:23
grondilu I did in previous versions, but it doesn't change the fact that it seemed superfluous to me. 11:24
Nemokosch What I don't know are the technical constraints - but frankly, I don't find the demand completely justified in the first place 11:25
code runs, well, at runtime, as a main rule
even in archmage C++
if you want to run code by the compiler, you indicate that 11:26
sounds sane to me
lizmat grondilu how do you know that Rakudo actually doesn't do that already ? 11:27
ok, looking at the code, that might actually be less than trivial :-) 11:29
grondilu lizmat: I had discussed few weeks ago here about whether it made sense to write `constant $ = Blob.new: some-code(@literal-values);` and I was told it did. Also we made some tests and it was quicker with `constant $ =` 11:30
well, not on first execution but on the next ones, IIRC
Nemokosch I think lizmat meant to say that there might already be optimizations of the kind you are looking for
but it turns out that maybe not? 11:31
if pure functions were strongly indicated in Raku, this could go further, I suppose
lizmat well, for instance: if you write "42 + 666", it will constant fold that to 708
grondilu To make sure I may write a specific test with a very expensive function I suppose.
lizmat and similar cases 11:32
if the static optimizer sees an expression consisting of constant values only, it will fold it
grondilu There is a pure trait that I considered using at some point, but I thought it was simpler to just use a BEGIN phaser
lizmat yeah, using BEGIN makes it easier to reason about as a developer 11:34
grondilu take for instance this : `blob32.new: map &floor ∘ * * 2**32 ∘ &abs ∘ &sin ∘ * + 1, ^64`. Do you think it would be compiled ASAP?
it's all constants and pure functions 11:35
or "constant fold", I'm not familiar with that terminology 11:36
I know I can just use BEGIN, but I like writing short code, and I'll take anything I can get to simplify things. 11:38
lizmat en.wikipedia.org/wiki/Constant_folding 11:40