Can't use variable names as the starting index of the slice when using a slice of a list. The shell interprets it as if it would be a namespace:
i = 2
put [ a b c d e ][$i:5]
It should output â–¶ [c d e], but it gives a compilation error that variable 5 is not found in the $i namespace.
What do you think about using .. (used in many languages e.g. Ruby, Crystal, Perl6) instead of : for slices?
You can wrap the variable in curly braces, like this:
put [ a b c d e ][{$i}:5]
â–¶ [c d e]
@zzamboni Another solution is [ a b c d e ][(put $i):5]. But both are ugly and hard to read.
Aha. Good point. Let's use ...
Planning to address this before 0.15.
If someone were to tackle this is the intent is to support : and .. with : marked as deprecated in the documentation?
Yes, and use of : for slices should emit a warning.
Most helpful comment
Aha. Good point. Let's use
...