|
02:16
human-blip left
04:38
swaggboi left
06:32
human-blip joined
13:08
librasteve_ joined
17:32
librasteve_ left
17:34
human-blip left
17:36
human-blip joined
18:36
librasteve_ joined
|
|||
| timemelon | when I run (1, 2, 3)[* - 4], it raises an Effective index out of range error, but when I run (1, 2, 3)[* - 4] // 0 I get 0 | 21:01 | |
| how does this work? does indexing 'know' that the // will try to use its result? | |||
| I was expecting to still see the error, I thought that // just checked for definedness | 21:02 | ||
| lizmat | m: dd (1, 2, 3)[* - 4] | 21:05 | |
| camelia | Failure.new(exception => X::OutOfRange.new(what => "Effective index", got => -1, range => "0..^Inf", comment => Any)) | 21:06 | |
| lizmat | it returns a Failure, which is a wrapped Exception. As soon as you use a Failure in any way other than .defined or .Bool, it will throw the exception | ||
| the // uses .defined, so it doesn't throw the exception, it just returns False | 21:07 | ||
| so // 0 will give you 0 | |||
| librasteve | m: say (1,2,3)[*-4].defined | ||
| Raku eval | False | ||
| timemelon | thanks! that makes sense | 21:10 | |
|
21:56
Guest63 joined,
Guest63 left
22:13
librasteve_ left
|
|||
| [0] > Seq(1, 2, 3).WHAT (Seq) [1] > list(Seq(1, 2, 3)).WHAT (Seq) [2] > List(Seq(1, 2, 3)).WHAT (List) [3] > Seq(1, 2, 3).list.WHAT (List) [4] > Seq(1, 2, 3).List.WHAT (List) how come the list sub behaves differently to List and the methods .list and .List here? the docs for list say > if called with a single argument that is a non-itemized Iterable it returns a List based on the argument's iterator; otherwise it just | 23:23 | ||
| returns the argument list. I think I'm missing something, this reads like it should make a list out of the seq, no? | |||