Cool!
Though note: (well, I thought bracketing might help, but no)
(,.&.":) 12 34 56
1
2
0
3
4
0
5
6
0
On Fri, 2010-08-13 at 19:09 -0400, Dan Bron wrote:
> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm