Jose Mario Quintana <[EMAIL PROTECTED]> wrote:
> "5!:5 y Linear. The linear representation is a string which, when
> interpreted, produces the named object."
>
>    9!:14''
> j601/beta/2006-08-07/09:40
>   
>    lr=. (5!:5)@<
>         
>    A=. <''
>    lr'A' 
> a:
>    B=. "[EMAIL PROTECTED]'A'
>    lr'B'
> a:
>      
>    A =  B
> 1
>    A -: B
> 1
>      
>    A (= &({:@>)) B
> 0
>    A (-:&({:@>)) B
> 0
>      
>    A =  a:
> 1
>    A -: a:
> 1
>      
>    A (= &({:@>)) a:
> 0
>    A (-:&({:@>)) a:
> 0

One of the idiosyncracies of empty arrays is that they are
considered equal, even if they have different data types.
This is rarely important, but the underlying data type can
reveal itself when fill elements are being used (as with {. or {:)
and certainly with 3!:0

   type =: 3!:0
   type&> a:  NB. boxed empty boolean list
1
   type&> <''  NB. Approximately equal to a: (but wrong fill element)
2
   type&> <i.0 NB. Even closer (correct fill element)
4
   type&> <0#0 NB. Identical to a: in every way
1

A problem with 5!:5 and 5!:6 is that they produce representations that are
equal to the original, but not necessarily IDENTICAL in all
aspects. For example, they do not preserve type:

   type f0=:-~1.5 NB. real clone of 0
8
   f0
0
   type "[EMAIL PROTECTED]'f0' NB. This forgets the 'realness' of the zero
1
   f0+!20x NB. real 0 trumps extended precision
2.4329e18
   ("[EMAIL PROTECTED]'f0')+!20x NB. freeze-dried and reconstituted 0 does not
2432902008176640000

(and, in the cited example, lr does not preserve the type of the empty list 
either).

-- Mark D. Niemiec <[EMAIL PROTECTED]>

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

Reply via email to