01:10
Guest41 joined
01:15
Guest41 left
02:20
razetime joined
04:07
Guest35 left
06:35
yolo joined,
yolo left
06:48
razetime left
07:22
razetime joined
09:31
TempIRCLogger__ joined,
TempIRCLogger__ left
09:32
TempIRCLogger__ joined,
RakuIRCLogger left,
lizmat left
09:33
TempIRCLogger left
09:34
TempIRCLogger__ left,
TempIRCLogger joined,
lizmat_ left,
lizmat joined
09:38
TempIRCLogger left,
TempIRCLogger joined
|
|||
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 | |
10:41
Nemokosch joined
|
|||
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 | ||
11:02
Nemokosch left
|
|||
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 | |
11:23
razetime left
11:59
frost joined
12:08
razetime joined
|
|||
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 | ||
13:50
Guest35 joined
14:48
frost left
|
|||
Nemokosch | Is this a standalone thing or just %? | 15:05 | |
15:10
razetime left
|
|||
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. | |||
15:25
razetime joined
|
|||
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 | |
17:06
razetime left
23:55
discord-raku-bot left
23:57
discord-raku-bot joined
|