J displays <1 2 and , <1 2 identically -- you can't tell from the display that 
the first is a scalar and the second is a one-element list.  The utility bi 
below boxes the items of non-scalars but displays scalars the way J does.  
Experiment with this utility.  Try bi i. 3 2 4 and bi <1 2 and
bi , <1 2 .  And try bi on }.  2; < 2 4 $ i.8 and on {:  2; < 2 4 $ i.8

bi =: (<"_1)`]@.(''-:$)  NB. box items of non-scalar arrays

--Kip Murray

Sent from my iPad

> On Oct 1, 2013, at 11:17 PM, Pascal Jasmin <[email protected]> wrote:
> 
> I am taking the shape after I have opened the item.  I'd expect it (the 
> insides) to be the same whether I got the item from }. or {:
> 
> 
> 
> ----- Original Message -----
> From: Roger Hui <[email protected]>
> To: Programming forum <[email protected]>
> Cc: 
> Sent: Wednesday, October 2, 2013 12:00:27 AM
> Subject: Re: [Jprogramming] strange difference between }. and {:
> 
> Not so strange.  }. and {: are not equivalent, even on 2-element lists.
> 
> 
> On Tue, Oct 1, 2013 at 8:56 PM, Pascal Jasmin <[email protected]>wrote:
> 
>>     $ >@}.  2; < 2 4 $ i.8
>> 1 2 4
>>     $ >@{:  2; < 2 4 $ i.8
>> 2 4
>> ----------------------------------------------------------------------
>> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to