piotrklibert What do you mean? Could you elaborate? Sounds intriguing... 🙂 10:33
Nemokosch let's say I have a 5x5 table _for some reason_ 10:41
the bridge doesn't work now 😐 10:43
so I can index this with 1;2 for example
it would be good if this worked backwards as well 10:45
I want h and get 1;2 as the index, rather than nest loops or something
Nemokosch bruh 10:47
Nemokosch oh it does work, I'm just stupid
Nemokosch m: dd ('a'..'z').rotor(5).List.[1;2] 10:48
camelia "h"
piotrklibert Yeah, another fun thing to try: `.[*;2]` 10:51
Nemokosch Indeed
gfldex <@297037173541175296> you need a `.deepantipair`. There may be a blogpost shortly. 11:03
Nemokosch 😮 11:06
sounds very cool
I planned to rather deal with a flat array, that's also manageable
piotrklibert I was just checking, thinking that maybe deepmap could be used with `:kv` - and then abused to do the search - but it doesn't seem to be possible 🙂 11:10
gfldex <@297037173541175296> gfldex.wordpress.com/2022/05/01/antipairing/ 12:24
Another way to do this would be to flatten the array and transform the indice with modulo. Modulo is kind of `.batch` for Ints. 12:35
Nemokosch Is this a standalone thing or just %? 15:05
piotrklibert Probably something like this: ``` 15:20
my $l = ('a'..'z').batch(4);
my $pos = $l.flat.first('y', :k);
$l[floor($pos/4); $pos % 4]
# y
```
In Python there's a utility called `divmod`, which combines integer division and modulo into a single call. It's trivial to write one in Raku, but I wasn't able to find an implementation in stdlib. 15:22
In Python there's a utility called `divmod`, which combines integer division and modulo into a single call (returning 2 values). It's trivial to write one in Raku, but I wasn't able to find an implementation in stdlib.
Nemokosch I mean yeah, it just sounded ("transform the indice with modulo; modulo is ...") as if "modulo" were an established thing for this particular problem and not just usual remainder calculation (which I'm well aware of) 15:41