Are conjunctions unassignable?

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 !

Are conjunctions unassignable?

Postby ArrayMac227 on Thu May 14, 2020 1:58 pm

opp←{⍺ ⍺⍺ ⍵⍵ ⍵}
tfuu←opp
SYNTAX ERROR
tfuu←opp


⍝ How do I assign opp?
ArrayMac227
 
Posts: 62
Joined: Sat Sep 12, 2015 1:40 pm

Re: Are conjunctions unassignable?

Postby Roger|Dyalog on Thu May 14, 2020 3:55 pm

In current Dyalog APL, a dyadic d-operator may be named using ←. No other dyadic operator may not so named. For example,

      rank←⍤
SYNTAX ERROR
rank←⍤
Roger|Dyalog
 
Posts: 238
Joined: Thu Jul 28, 2011 10:53 am

Re: Are conjunctions unassignable?

Postby Phil Last on Fri May 15, 2020 10:16 am

Roger|Dyalog wrote:... a dyadic d-operator may be named using ←. ...
but not reassigned as Randy discovered
Randy wrote:... tfuu←opp ...
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: Are conjunctions unassignable?

Postby Phil Last on Fri May 15, 2020 4:14 pm

You can't create a reference to it
      )clear
clear ws
opp←{⍺←⊢ ⋄ (⍺ ⍺⍺ ⍵)⍵⍵ ⍵}
)ns s
#.s
s.op←opp
SYNTAX ERROR
s.op←opp
either thither ↑ or thence ↓
      )cs s
#.s
op←#.opp
SYNTAX ERROR
op←#.opp
^
but you can call it directly with its fully qualified name
      2 + #.opp × 3
15
or you can create a cover that does that for you
      op←{⍺←⊢ ⋄ ⍺ ⍺⍺ #.opp ⍵⍵ ⍵}
2 + op × 3
15
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex


Return to APL Chat

Who is online

Users browsing this forum: No registered users and 1 guest