APL2: compress with nested arrays? 
Author Message
 APL2: compress with nested arrays?

In IBM APL2, you have to define a function to do compression
  del R gets B COMPRESS A
  R gets B/A del
And then use it with each:
  C gets B COMPRESS each A


Sat, 23 Aug 1997 20:06:44 GMT  
 APL2: compress with nested arrays?

Quote:

>Subject: APL2: compress with nested arrays?
>Date: 7 Mar 1995 07:49:56 GMT
>I am looking for an APL2-expression which solves the following
>problem:
>A<-| |0 2 0| |1 0 0| |0 2 3| |
>I need an expression, which generates from the array 'A' the following
>array, whithout any loop, of course:
>   | |2| |1| |2 3| |
>I thought, I could use compression, but it doesn't work:
>Is there a simple solution for this problem?

In the problem you describe why not use the without function in strand
notation?

 A <- A ~ [dieresis] 0

Don Wiss.



Sun, 24 Aug 1997 07:31:18 GMT  
 APL2: compress with nested arrays?
It is because / and \ represent operators, not functions, and in
expressions  

        data1 / data2

and

        data1 \ data2

the "data1" item is an operand, not an argument -- which means they

can be punctuated

        (data1/)data2     and     (data1\)data2

The function derivation happens before the application of the

derived function ...

--



Sun, 24 Aug 1997 13:57:15 GMT  
 APL2: compress with nested arrays?
I am looking for an APL2-expression which solves the following
problem:

   +-------------------------+
   | +-----+ +-----+ +-----+ |
A<-| |0 2 0| |1 0 0| |0 2 3| |
   | +-----+ +-----+ +-----+ |
   +-------------------------+

I need an expression, which generates from the array 'A' the following
array, whithout any loop, of course:

   +---------------+
   | +-+ +-+ +---+ |
   | |2| |1| |2 3| |
   | +-+ +-+ +---+ |
   +---------------+

I thought, I could use compression, but it doesn't work:

B<-~A=0

C<-B/A or C<-B/{each}A or something like that.

Is there a simple solution for this problem?

Thanks Elmar.

--

Institute for Information Technology Systems | Tel: +49 231 755 4513
University of Dortmund                       | Fax: +49 231 755 3251
44221 Dortmund / Germany



Sat, 23 Aug 1997 15:49:56 GMT  
 APL2: compress with nested arrays?
Quote:

>  In IBM APL2, you have to define a function to do compression
>    del R gets B COMPRESS A
>    R gets B/A del
>  And then use it with each:
>    C gets B COMPRESS each A

Same with expand\replicate.  I think this is because the slashes
double up as symbols for the operators reduce and scan.  Other
functions should work as expected.




Sun, 24 Aug 1997 01:46:00 GMT  
 APL2: compress with nested arrays?

|> >I am looking for an APL2-expression which solves the following
|> >problem:
|> >A<-| |0 2 0| |1 0 0| |0 2 3| |
|>
|> >I need an expression, which generates from the array 'A' the following
|> >array, whithout any loop, of course:
|> >   | |2| |1| |2 3| |
|>  

|> In the problem you describe why not use the without function in strand
|> notation?
|>
|>  A <- A ~ [dieresis] 0

Thank you. That is a solution I was looking for.
Sometimes the solution is so simple, that one don't see it.
In Germany we have a saying for it: 'Man sieht den Wald vor lauter
Baeumen nicht' which means in english: You don't see the forest
because of all the trees. :-)

Elmar.
--

Institute for Information Technology Systems | Tel: +49 231 755 4513
University of Dortmund                       | Fax: +49 231 755 3251
44221 Dortmund / Germany



Sun, 24 Aug 1997 15:44:31 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. QUERY ON +.x ON NESTED ARRAYS IN APL2

2. That nested nested nested if statement...

3. Sharp APL (really SAPL and APL2 arrays)

4. How Convert MS EXCEL Spreadsheet to an APL2 Array

5. apl2 question: array item patterns

6. APL2 (was Re: Fortran90 and arrays)

7. APL2/2 to APL2/W95/NT

8. APL Nested Array Questions

9. How are nested arrays internally stored?

10. APLASCII format of singleton nested arrays

11. nested array won't work

12. access type referencing nested array element

 

 
Powered by phpBB® Forum Software