Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
removing APL nesting level question
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Don Wiss  
View profile  
 More options Sep 6 2012, 12:29 pm
Newsgroups: comp.lang.apl
From: Don Wiss <donwiss@no_spam.com>
Date: Thu, 06 Sep 2012 12:29:52 -0400
Local: Thurs, Sep 6 2012 12:29 pm
Subject: removing APL nesting level question
My APL learning years were before nested arrays came along. Hence I am weak
in certain areas. I am using APL+Win.

I have 1600 recipes in 43 chapters. I have a vector of 43 and each element
is a vector of the recipe names in that chapter. I'd like to remove a level
of nesting and end up with a vector of the 1600 names.

It must be something real simple...

Don. www.paleofood.com (e-mail link at home page bottom).


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rav  
View profile  
 More options Sep 6 2012, 1:13 pm
Newsgroups: comp.lang.apl
From: Rav <Pa...@cais.com>
Date: Thu, 06 Sep 2012 13:13:02 -0400
Local: Thurs, Sep 6 2012 1:13 pm
Subject: Re: removing APL nesting level question
On 9/6/2012 12:29 PM, Don Wiss wrote:

> My APL learning years were before nested arrays came along. Hence I am weak
> in certain areas. I am using APL+Win.

> I have 1600 recipes in 43 chapters. I have a vector of 43 and each element
> is a vector of the recipe names in that chapter. I'd like to remove a level
> of nesting and end up with a vector of the 1600 names.

> It must be something real simple...

> Don. www.paleofood.com (e-mail link at home page bottom).

Assuming your 43-item vector looks like this (here, just 4 chapters):

       ⍴a←(,⊂'Only one recipe in this chapter') ('Ch 2 Recipe 1' 'Ch 2
Recipe 2') (0⍴⊂'') ('Ch4 R1' 'Ch4 R2' 'Ch4 R3')
4
       ⍴ša ⍝ Number of recipes in each chapter.
  1  2  0  3

Then this will do what you want, I think:

       ⍴⊃,/a
6

/Rav


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Graham  
View profile  
 More options Sep 6 2012, 3:22 pm
Newsgroups: comp.lang.apl
From: "Graham" <h2gt2g42-micenewgro...@yahoo.co.uk>
Date: Thu, 6 Sep 2012 20:22:49 +0100
Local: Thurs, Sep 6 2012 3:22 pm
Subject: Re: removing APL nesting level question

"Don Wiss" <donwiss@no_spam.com> wrote in message news:7gjh4892043kfd416o93omijmv07v24sfq@4ax.com...
> My APL learning years were before nested arrays came along. Hence I am weak
> in certain areas. I am using APL+Win.

> I have 1600 recipes in 43 chapters. I have a vector of 43 and each element
> is a vector of the recipe names in that chapter. I'd like to remove a level
> of nesting and end up with a vector of the 1600 names.

> It must be something real simple...

Enlist

Return a simple vector comprising the simple items of arg arranged in depth first row-major order. R is any array.

r← ∊{your 43 element vector} should do the trick

Graham.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rav  
View profile  
 More options Sep 6 2012, 6:09 pm
Newsgroups: comp.lang.apl
From: Rav <Pa...@cais.com>
Date: Thu, 06 Sep 2012 18:09:23 -0400
Local: Thurs, Sep 6 2012 6:09 pm
Subject: Re: removing APL nesting level question
On 9/6/2012 3:22 PM, Graham wrote:

If what he wants to end up with is a 1600 element vector, with each
element containing one recipe, then enlist will not do it -- it would go
"too far."  Enlist would remove ALL levels of nesting (he indicated
remove "a" level, which I interpreted as meaning one level), and he'd
end up with one simple character vector containing all the recipes all
smooshed together.  Don, clarification?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Don Wiss  
View profile  
 More options Sep 7 2012, 12:00 am
Newsgroups: comp.lang.apl
From: Don Wiss <donwiss@no_spam.com>
Date: Fri, 07 Sep 2012 00:00:10 -0400
Local: Fri, Sep 7 2012 12:00 am
Subject: Re: removing APL nesting level question

On Thu, 06 Sep 2012 13:13:02 -0400, Rav <Pa...@cais.com> wrote:
>On 9/6/2012 12:29 PM, Don Wiss wrote:
>> I have 1600 recipes in 43 chapters. I have a vector of 43 and each element
>> is a vector of the recipe names in that chapter. I'd like to remove a level
>> of nesting and end up with a vector of the 1600 names.
>Then this will do what you want, I think:

>       ??,/a

As in: {take},/a

Yes. That works just fine. Thanks.

Don. www.donwiss.com (e-mail link at home page bottom).


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charles Brenner  
View profile  
 More options Sep 7 2012, 2:39 pm
Newsgroups: comp.lang.apl
From: Charles Brenner <cbren...@berkeley.edu>
Date: Fri, 7 Sep 2012 11:39:44 -0700 (PDT)
Local: Fri, Sep 7 2012 2:39 pm
Subject: Re: removing APL nesting level question
On Sep 6, 9:00 pm, Don Wiss <donwiss@no_spam.com> wrote:

> On Thu, 06 Sep 2012 13:13:02 -0400, Rav <Pa...@cais.com> wrote:
> >On 9/6/2012 12:29 PM, Don Wiss wrote:
> >> I have 1600 recipes in 43 chapters. I have a vector of 43 and each element
> >> is a vector of the recipe names in that chapter. I'd like to remove a level
> >> of nesting and end up with a vector of the 1600 names.
> >Then this will do what you want, I think:

> >       ??,/a

> As in: {take},/a

> Yes. That works just fine. Thanks.

You are right; {take} works. But the symbol Rav used which may have
gotten lost in your browser was a disclose (right horseshoe). Just as
a matter of esthetics I like disclose better. The shape of ,/a is the
shape of a scalar. {take} of it means take the first element, but
there really is no "first" element of a scalar just as there is no
first element of a 3x4 matrix. Given that {take}3 4{rho}'asdfasdfasdf'
isn't allowed, the fact that {take}7 or {take},/a is allowed feels to
me not to be purist APL.

Charles


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rav  
View profile  
 More options Sep 7 2012, 3:55 pm
Newsgroups: comp.lang.apl
From: Rav <Pa...@cais.com>
Date: Fri, 07 Sep 2012 15:55:16 -0400
Local: Fri, Sep 7 2012 3:55 pm
Subject: Re: removing APL nesting level question
On 9/7/2012 2:39 PM, Charles Brenner wrote:

Hi, Charles.  While I happen to agree with you that disclose is
preferable (since the intent is to remove a level of nesting, and not
take the "first" element), and that's why I used it, at least in APL+Win
and NARS2000  {take}3 4{rho}'asdfasdfasdf'  does work (returns 'a').  I
don't know about Dyalog or others.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Aaron W. Hsu  
View profile  
 More options Sep 7 2012, 8:34 pm
Newsgroups: comp.lang.apl
From: Aaron W. Hsu <arcf...@sacrideo.us>
Date: Fri, 07 Sep 2012 19:34:47 -0500
Local: Fri, Sep 7 2012 8:34 pm
Subject: Re: removing APL nesting level question

Rav <Pa...@cais.com> writes:
>Hi, Charles.  While I happen to agree with you that disclose is
>preferable (since the intent is to remove a level of nesting, and not
>take the "first" element), and that's why I used it, at least in APL+Win
>and NARS2000  {take}3 4{rho}'asdfasdfasdf'  does work (returns 'a').  I
>don't know about Dyalog or others.

In Dyalog there is the migration level. If you are using migration
levels greater than 2, then I am not sure what using {take} would do,
but I think it would have the effect of being a first  or disclose
operation and would work on 3 4⍴⍳12 for example. However, with migration
levels below 2, which is the default, ↑3 4⍴⍳12 gives you the same
thing back, while ⊃3 4⍴⍳12 gives you 1. I think this is because
the {take} function in migration level 0 flattens out a list that is
nested. That is, (⍴↑3 4⍴⊂⍳12)≡3 4 12.

--
Aaron W. Hsu | arcf...@sacrideo.us | http://www.sacrideo.us
Programming is just another word for the lost art of thinking.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charles Brenner  
View profile  
 More options Sep 9 2012, 1:26 pm
Newsgroups: comp.lang.apl
From: Charles Brenner <cbren...@berkeley.edu>
Date: Sun, 9 Sep 2012 10:26:24 -0700 (PDT)
Local: Sun, Sep 9 2012 1:26 pm
Subject: Re: removing APL nesting level question
On Sep 7, 12:55 pm, Rav <Pa...@cais.com> wrote:

Right you are, also with the DOS versions of Manugistics APL (versions
5 & 6 -- called APL+DOS I think but I'm never sure) that I've been
using for years, always incorrectly assuming that this pearl of an
expression was unavailable to me. The times I could have had!

Charles


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »