Yep. Put an 'x' behind or a 'x:' in front.
":^:_1 'x',~ -.&' ' ": 1234567 456789 23345567 34446
":^:_1 'x:', -.&' ' ": 1234567 456789 23345567 34446
Now, while these two sentences are theoretically fungible, and &.": is cute,
in reality ":^:_1 is monad ". , which is dangerous (":^:_1 '1!:55 ...' for
example).
So, if I were going to apply this code to user input (or anything derived
from user [untrusted] input), I'd opt for the former, because whereas the
leading-x: solution _requires_ code evaluation, the trailing-x solution is
amenable to a reformulation using _dyad_ ". , which is safe.
So (again, if the input is untrusted or derived from an untrusted source) I
might recommend:
0 ". 'x',~ -.&' ' ": 1234567 456789 23345567 34446
The 0 is arbitrary; use some value which is outside the (desired) range of
your function. That is, substitute for zero some value which you can
reliably distinguish from valid output for your universe of valid inputs
(though they're tempting, I would avoid infinite sentinels; they tend to
cause havoc downstream when you attempt to aggregate outputs. Don't even
consider _.).
All that said, I think it's algebraically cute that the two sentences are
exactly the same length (the latter adds a : but drops a ~ from the former,
and vice-versa).
-Dan
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Alex
Giannakopoulos
Sent: Sunday, September 15, 2013 9:48 AM
To: J Programming forum
Subject: Re: [Jprogramming] Joining up a rank-1 array of integers
Yup that did it!
":^:_1 'x',~ -.&' ' ": 1234567 456789 23345567 34446
12345674567892334556734446
Shoulda thought of it! Cheers, Raul!
On 15 September 2013 14:40, Raul Miller <[email protected]> wrote:
> On Sun, Sep 15, 2013 at 9:34 AM, Alex Giannakopoulos
> <[email protected]> wrote:
> > How can I incorporate an x: (or equivalent) into the "ijoin" verb,
> > to ensure correct bignums?
>
> You might append an 'x' to the right hand side of the numeric string?
>
> Thanks,
>
> --
> Raul
>
>
> --
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm