Raul wrote:
> {.&.":&> seems more natural than anything involving #: or #.inv
I'll buy that as a practical matter. But as a notational matter, it just
doesn't "feel" right to me. My input is numbers and my output is numbers
and fundamentally I'm doing arithmetic - so why should I have to translate
to strings & back? (I know the answer, I'm just giving you my thought
process. This similar to the reason I was nettled by "."0@": being
optimized rather than 10&#.^:_1 [1] .)
> An issue here is that #: and #.inv are designed to pad with leading
Yep, that's what stymied the first correction I sent to Bjorn: I had [:
({."1) 10 #.^:_1 p:@:i. but I had to change it to {.@(10&#.^:_1)@p:@:i.
for exactly this reason (naturally, I realized this 14 microseconds after
hitting "send" - OTOH I am always pleased to find a natural use for @ as
opposed to @: and since {."1 required parens anyway, the new formulation
wasn't any messier).
But #: padding on the left is helpful much more often than it is a
nuisance (we're array programmers, after all), so I shouldn't complain.
-Dan
[1] http://www.jsoftware.com/help/release/digits10.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm