Raul wrote:
> It converts a number to a string of digits?
The disconnection is on how to interpret "string of digits". If Alex
desires character output, then ": suffices (though it may not be obvious to
him what has changed, how to address the digits individually, or why it
"acts funny" when used on a non-scalar array).
But if he desires numeric output, then another approach is needed.
I wrote:
> ,.&.": 1000
> 1 0 0 0
> .. epitomizes the Perl approach of
> projection into the string domain,
> transformation,
> and return.
The suitability of ": hinges on the desirability of that last step: whether
or not return [to the integer domain].
Here's one way to grade a Jem: what generalizations does it suggest?
We notice that we're using &. (under), the explicit expression of making a
projection, transforming, and returning. So if we didn't want to return,
what would we use? Why, &.'s de-freckled brother, & ("compose"/"with"), of
course!
Here's another way to grade a Jem: do the generalizations it suggests
actually work?
,.& ": 1000
1
0
0
0
(which I suspect will make the "digitization" more obvious).
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm