`ew` raises too many exceptions
A stack-oriented programming language suitable for code golfing
Status: Alpha
Brought to you by:
aditsu
[1]2ew raising an invalid slice size exception means you cannot use 2ew if you don't the array length beforehand.
I'd expect 2ew to behave like [_\1>]zW<, so Array Long ew should just return an empty array if the Long is longer than the Array.
Also, negative slice sizes could be used to reverse slices inner order:
[1 2 3]-2ew e# Gives [[2 1] [3 2]]
Here is another generalisation that seems useful and would have saved me a dozen bytes or more just now:
which would give
That is
[m n]would give a grid of allm x nsub-blocks. This would easily generalise to arbitrary dimensions, but it seems most useful for processing ASCII grids.Here's another use case for
Array Long ewgiving empty array whenLongis larger than the length of theArray: linkI've implemented the "return empty array if the number is too large" part