I initially thought that. But f's both arguments can be anything and the behavior changes with which one is which. So can you not say that doing 5Xf+ means doing [0 1 2 3 4][0]f+ which gives [[0 0] [1 0] [2 0] [3 0] [4 0]] ?
What is the differentiating factor here ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
f expects the leftmost argument to be iterable and only iterates over the right one if the left one isn't. Implementing Long Long f as Martin suggests is consistent with that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah I meant what Dennis said. If it's Long Long f you turn the first one into a range. One could also implement Character Long f, by either turning the character into a string, or the long into a range. I think the latter would be more consistent and likely more useful, since none of the block operators currently turn characters into strings I think.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The same goes for the .X operator. If any of the two operands is a number (or heck if both are numbers), then do an implicit ,
This way, we can do quite a few things in a shorter manner. Get an array of first N squares ? :
N_.*
Instead of the usual
N,2f#
or
N{_*}%
Can I add
f
to the list? Like5Xf+
gives[1 2 3 4 5]
.I initially thought that. But
f
's both arguments can be anything and the behavior changes with which one is which. So can you not say that doing5Xf+
means doing[0 1 2 3 4][0]f+
which gives[[0 0] [1 0] [2 0] [3 0] [4 0]]
?What is the differentiating factor here ?
f
expects the leftmost argument to be iterable and only iterates over the right one if the left one isn't. ImplementingLong Long f
as Martin suggests is consistent with that.<ignore this="">
Last edit: Optimizer 2015-05-15
Yeah I meant what Dennis said. If it's
Long Long f
you turn the first one into a range. One could also implementCharacter Long f
, by either turning the character into a string, or the long into a range. I think the latter would be more consistent and likely more useful, since none of the block operators currently turn characters into strings I think.Last edit: Optimizer 2015-05-15