This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html Set by lizmat on 8 June 2022. |
|||
00:00
human-blip left,
swaggboi joined
00:01
human-blip joined
00:42
mcmillhj left
00:48
jaguart joined
00:49
jaguart left
00:51
jaguart joined
03:51
jaguart left
03:52
jaguart joined
04:01
MasterDuke joined
09:16
dakkar joined
|
|||
librasteve | mcmillhj: fwiw I have tested your code (at least the bit that I can get from your link) and sort works fine for me ... gist.github.com/librasteve/170121d...af841c294e | 11:45 | |
mcmillhj: and, eventually, I realise that I made the same jump that you did and when I comment out the Str method, it fails as you have already said - looks like nemokosch is spot on with this | 12:54 | ||
ironically ... I then discovered this SO stackoverflow.com/questions/537609...ridden-cmp where the same discussion was had on 13th December 2018! | 12:55 | ||
17:37
dakkar left
19:04
Manifest0 joined
21:28
mcmillhj joined
22:31
kjp left
22:34
kjp joined
|
|||
mcmillhj | What's the more idiomatic way to compare two Seqs? I know `eqv` doesn't work because they are lazy | 22:56 | |
nemokosch | it doesn't? that sounds annoying | 23:14 | |
lizmat | m: dd (^10).Seq.list eqv (^10).Seq.list # convert to list ? | 23:15 | |
camelia | Bool::True | ||
lizmat | hmmmm | ||
m: dd (^10).Seq.list eqv (^10).Seq.lazy.list | 23:16 | ||
camelia | Bool::False | ||
lizmat | hmmmm | ||
nemokosch | it's hard to say this well | ||
there are 3 states | |||
there is something that is just plain eager cached data | 23:17 | ||
there is something where we just don't know | |||
and there is something where the iterator is explicitly marked as lazy | |||
mcmillhj | yeah, that is what I am struggling with. I wrote a little helper function that just takes two positional arguments and compares them element by element. Sometimes one of the arguments is a List sometimes a Seq, sometimes an Array | 23:18 | |
lizmat | m: dd so ((^10).Seq.lazy Zeqv (^10).Seq.lazy).all | ||
camelia | Bool::True | ||
nemokosch | a Seq can still be "don't know" rather than "explicitly lazy" | ||
and then there is no problem | |||
m: (1, 2, 3).Seq eqv (1, 2, 3).Seq andthen .say | |||
Raku eval | True | ||
mcmillhj | okay, so the main issue is that one of the arguments is a Seq and the other is a List then because eqv asserts against type right? | 23:19 | |
nemokosch | yes, usually it does | 23:20 | |
but then I'm kinda leaning towards some of the solutions from liz | 23:22 | ||
they really aren't "equivalent", just happen to have the same content when iterated | |||
mcmillhj | as long as something like this looks readable I guess I am okay. It looked weird when I wrote it this way the first time | 23:28 | |
m: my @rows = [305, 289, 460, 223, 223, 460, 289]; my $i = 3; my @left = @rows[0..$i]; my @right = @rows[$i + 1 .. * - 1]; my $closest-edge = min(@left.elems, @right.elems); say @left.reverse[0..^$closest-edge].List eqv @right[0..^$closest-edge].List; | |||
camelia | True |