07:48
dakkar joined
13:45
randomnick joined
13:46
randomnick left
|
|||
Sky | in rosettacode.org/wiki/Identity_matrix#Raku `[1, |(0 xx $n-1)], *.rotate(-1) ... *[*-1]` is used to generate an identity matrix, how does `*[*-1]` work here? I thought the `*` at end meant infinity in ranges and sequences, and last element of infinity doesn't make much sense... | 13:53 | |
lizmat | * is more about "Whatever" generally, than Infinity | 14:02 | |
if something is bound in some other way, then * just indicates to what it is bound, and [*-1] then indicates the last element | 14:03 | ||
Sky | in that case `*[*-1]` is basically a function returning the last element? | 14:04 | |
lizmat | yes | ||
say *[*-1]( (1,2,3) ) # 3 | 14:05 | ||
Sky | okay, docs.raku.org/language/operators#infix_... says "If the endpoint is not *, it's smartmatched against each generated element and the sequence is terminated when the smartmatch succeeded. The final element is excluded of the sequence if a sequence operator variant with a final caret is used, it is included otherwise.". so, the last element is being treated as a boolean here, and the list stops | 14:08 | |
makes a lot more sense, thanks! | |||
lizmat | yw! | 14:10 | |
16:35
dakkar left
19:23
TempIRCLogger left,
TempIRCLogger joined
19:34
TempIRCLogger left
19:35
TempIRCLogger joined
19:38
mjgardner joined
19:58
sjn joined
20:52
TempIRCLogger left,
TempIRCLogger joined
|