Assigning to an expression with dfns

For users of dfns, both novice and expert
Post Reply
User avatar
OSRK
Posts: 17
Joined: Tue Dec 27, 2016 8:48 am

Assigning to an expression with dfns

Post by OSRK »

      v←0 0 
myfunc←⊃
(2⊃v)←3
(2 myfunc v)←2
SYNTAX ERROR
(2 myfunc v)←2

myfunc2←{⍺⊃⍵}
(2 myfunc2 v)←2
SYNTAX ERROR
(2 myfunc2 v)←2

Why?

How to create a kind of custom sub-select function that could be used on the left side of assignment?
JohnS|Dyalog

Re: Assigning to an expression with dfns

Post by JohnS|Dyalog »

The selective assignment construct allows only a subset of primitive functions inside its parentheses. These primitive functions are being applied to an internal structure representing the indices of the subject array, which is meaningless to more general functions, such as the dfn {⍺⊃⍵} in your myfunc2 example.

PS: for selective specification of array items, try the primitive @ operator.
      3@2 ⊢0 0
0 3

John
Post Reply