Matthew Brand wrote:
>  the thing I hate most about J is...
>     # $ '1'
> 0
>     # $ '12'
> 1

Yes, but I bet you don't hate, e.g.

           3 * i. 4 4
         0  3  6  9
        12 15 18 21
        24 27 30 33
        36 39 42 45

So yes, that a single specified atom is a scalar is inconsistent with the fact 
that multiple specified atoms are vectors, but it's
an incredibly useful inconsistency (think Perl here).  I think I would be 
caught out more if consistency were maintained and e.g.
3 -: ,3   .  Because then:
           
           3 * i. 4 4
        |length error
        |   3    *i.4 4
           
Ouch.   And even if the consistency allowed me to remember this situation, it 
would be a pain to always type  {.3   where I would
type simply  3  today (esp. as that would often require parens).  

So, IMO, having to construct single-atom vectors is no worse than having to 
construct multidimensional arrays, or boxed arrays, or
symbol arrays, or any other common thing that the native constant notation 
doesn't support.  And this particular case really isn't
too bad.  Instead of

>  x =. ,:^:(0:=#@:$) x

You could write  x =: ,x  . 

-Dan


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to