[Jprogramming] Boxing Data -- inverse of copy?

Pascal Jasmin godspiral2000 at yahoo.ca
Fri Apr 20 09:10:21 HKT 2007


#^:_1 looks interesting, but I'm having difficulty experimenting with what it does.

the bx verb is very fast, but doesn't work if x is an atom (rsdy fixed with ,x)
did a forum and doc search for #^:_1 and found nothing.

----- Original Message ----
From: Roger Hui <rhui000 at shaw.ca>
To: Programming forum <programming at jsoftware.com>
Sent: Thursday, April 19, 2007 8:21:08 PM
Subject: Re: [Jprogramming] Boxing Data

   (*x) #^:_1 (x#i.#x) </. y
+--------++-----+
|11 12 13||14 15|
+--------++-----+
   bx=: *@[ #^:_1 (#i.@#)@[ </. ]
   x bx y
+--------++-----+
|11 12 13||14 15|
+--------++-----+



----- Original Message -----
From: "Leigh J. Halliwell" <leigh at lhalliwell.com>
Date: Thursday, April 19, 2007 5:02 pm
Subject: [Jprogramming] Boxing Data

> Dear J Forum:
> I want to box a vector of numbers and want to box according to another
> vector that tells how many to put in the boxes.  For example, 11 
> 12 13 14 15
> BoxAccTo 3 0 2 means (11 12 13); ace; (14 15).  It's important 
> that zeroes
> produce empty boxes.  Also, +/ of the second vector must equal # 
> of the
> first.
> I've created a tacit function that does the job.  However, I 
> suspect that
> it's inefficient.  In particular, it doesn't use the cut primitive 
> (;),because cut doesn't like boxing 0 elements.  So I hope that 
> you can come up
> with simpler, more efficient tacit functions.  
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm





      Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail at http://mrd.mail.yahoo.com/try_beta?.intl=ca



More information about the Programming mailing list