Yes.

That said, I also made that choice so I could be demonstrating the use
of the 'at' conjunction.

In the general case, this idiom gets a fair bit of use because of J's
word formation rules.

Consider, for example:

  1 ,&> 2 3 4

If I were to instead use
   1 ,"0 2 3 4
that would be an error because 0 2 3 4 is a single word in J.  (As an
aside, note that '0 2 3 4' is also a single word in J.)

I could instead use
   1 ,("0) 2 3 4
or
   1 (,"0) 2 3 4
or
   1 ,"0 (2 3 4)
or
   1 ,"0 ] 2 3 4
or
   1 ,"0 [ 2 3 4
or
   1 (0 (,")) 2 3 4
or
   1 ,"0 > 2 3 4
or ...

But &> is convenient because it's so simple to type.  And, it
accomplishes the same thing for this domain (which might be good
enough)  But, note that if you really want to support boxed data you
should probably also include some tests or examples to help make sure
that boxed data is handled properly and to demonstrate the concept.

FYI,

-- 
Raul

On Wed, Jan 2, 2013 at 2:43 PM, Peter B. Kessler
<[email protected]> wrote:
> Am I correct that in your example, you are using Open (>) just for its rank
> (monadic 0), and not for its verb (the inverse of Box)?  That is
>
>       < @ i. @ ]"0 ( 2 3 4 )
>    +---+-----+-------+
>    |0 1|0 1 2|0 1 2 3|
>    +---+-----+-------+
>
> would work as well.  (Parens around the argument are needed to separate it
> from the Rank conjunction ("0).  I've also seen Same (]) used as a
> separator.)  I think the point is that you want the Box Atop Integers (< @
> i.) to operate on the atoms of its argument, not on the argument as a whole.
>
> A more explicit way of saying you want a rank 0 verb is to use
>
>       (< @ i.)"0 ( 2 3 4 )
>    +---+-----+-------+
>    |0 1|0 1 2|0 1 2 3|
>    +---+-----+-------+
>
> I find it confusing when I see Open used just for its rank.  (But I'm
> learning. :-)  If my explanation is correct, maybe it will help someone else
> learn this idiom.
>
>                         ... peter
>
> Raul Miller wrote:
>>
>> Here's a definition for at which works exactly like @
>>
>>    at=: 2 :'([: u v)"v
>>
>> For example:'
>>    <at i. at > 2 3 4
>>
>> Now, looking at that, you may think that this means that [: is somehow
>> superior to @ but note that [: is not necessary
>>
>>    at=: 2 :'u@:v"v'
>>
>> Note that in J, @: and @ (without the colon) are different words.
>>
>> It's also possible to replace @: with an explicit definition, but
>> that's probably best left for another time.
>>
>> FYI,
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to