:Section :EndSection in a :For loop

APL-related discussions - a stream of APL consciousness.
Not sure where to start a discussion ? Here's the place to be
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !

:Section :EndSection in a :For loop

Postby ray on Tue Dec 22, 2020 12:39 am

I cant see why one cannot put a
Code: Select all
:Section .... :EndSection
within a
Code: Select all
:For....:EndFor
loop.

EG
Code: Select all
      ∇Foo∇
     ∇ Foo;i
[1]
[2]    :For i :In 1 2
[3]
[4]       ⍝ :Section
[5]        i
[6]       ⍝ :EndSection
[7]
[8]    :EndFor
     ∇
      Foo
1
2
       ∇Foo∇
     ∇ Foo;i
[1]
[2]    :For i :In 1 2
[3]
[4]        :Section
[5]            i
[6]        :EndSection
[7]
[8]    :EndFor
     ∇
       Foo
SYNTAX ERROR
Foo[2] :For i :In 1 2
                  ∧


Is there a reason for this behavior, or is it a bug?
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
ray
 
Posts: 192
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK

Re: :Section :EndSection in a :For loop

Postby petermsiegel on Tue Dec 22, 2020 4:31 am

On the Mac's most current version, it seems to work...
Perhaps it's a premium feature.

Code: Select all
     ∇Foo[⎕]∇
[0]   Foo;i
[1]   :For i :In 1 2
[2]        :Section
[3]         i
[4]        :EndSection
[5]   :EndFor
Foo     
1
2
petermsiegel
 
Posts: 98
Joined: Thu Nov 11, 2010 11:04 pm

Re: :Section :EndSection in a :For loop

Postby AndyS|Dyalog on Tue Dec 22, 2020 8:51 am

Which version of Dyalog APL are you using Ray ?

The behaviour seems to have changed between 17.0 and 17.1 - you cannot put a :section in a :for loop in 17.0, but you can in 17.1 and later.

The Dyalog interpreter is the same for all users, and is built on all platforms from the same source. We may occasionally add an I-beam for a customer, either as a feature enhancement, or to aid debugging, but most of those usually end up as standard features in future versions. So no, no premium features at play here !
User avatar
AndyS|Dyalog
 
Posts: 245
Joined: Tue May 12, 2009 6:06 pm

Re: :Section :EndSection in a :For loop

Postby ray on Wed Dec 23, 2020 11:32 pm

Thanks Andy, I'm still using version 17.0, so I am now happy.

Seasons Greeting to you all.
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
ray
 
Posts: 192
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK

Re: :Section :EndSection in a :For loop

Postby ray on Sun Dec 27, 2020 9:54 am

P.S.

:Section is now working fine for me in a :for loop under Dyalog 18.0.

Many thanks, and a Happy New Year
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
ray
 
Posts: 192
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK


Return to APL Chat

Who is online

Users browsing this forum: No registered users and 1 guest