Two ways:

   s=: (1e5 [EMAIL PROTECTED] 1e6) (1e5 [EMAIL PROTECTED] 1e9)} 1$. 1e9
   $s
1000000000
   (3!:1 s) 1!:2 <'\junk\foo'
   s -: 3!:2 (1!:1) <'\junk\foo'
1
   
   (3!:1 ] 4$.s) 1!:2 <'\junk\ii'
   (3!:1 ] 5$.s) 1!:2 <'\junk\xx'
   s -: (3!:2 (1!:1) <'\junk\xx') (<"1 (3!:2) 1!:1 <'\junk\ii')} 1$.1e9
1



----- Original Message -----
From: "Philip A. Viton" <[EMAIL PROTECTED]>
Date: Sunday, June 1, 2008 8:41
Subject: [Jprogramming] recreating a sparse array
To: [email protected]

> 
> Given a dense array mx, we can create a sparse version via $. 
> say 
> smx. Then we can extract the make-up of smx (what the dictionary 
> refers to as sh, a, e, i and x) using dyadic $. Suppose I store 
> these 
> elements in a jfile (to save space, for example). Is there an 
> easy 
> way to use them to reconstitute the sparse array? I know I can 
> do 
> this by writing my own verb, but I would have thought that the 
> language would have provided a way to do this; and I can't find it.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to