Assigning to an expression with dfns

For users of dfns, both novice and expert

Assigning to an expression with dfns

Postby OSRK on Fri Sep 14, 2018 9:54 am

      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?
User avatar
OSRK
 
Posts: 12
Joined: Tue Dec 27, 2016 8:48 am

Re: Assigning to an expression with dfns

Postby JohnS|Dyalog on Sat Sep 15, 2018 7:42 am

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
JohnS|Dyalog
 


Return to Functional Programming

Who is online

Users browsing this forum: No registered users and 1 guest