Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: selective assignment (with a commute on the left) #289

Open
justin2004 opened this issue Dec 29, 2024 · 2 comments
Open

question: selective assignment (with a commute on the left) #289

justin2004 opened this issue Dec 29, 2024 · 2 comments

Comments

@justin2004
Copy link
Contributor

justin2004 commented Dec 29, 2024

Selective assignment (with replicate on the left) works as expected (in April and Dyalog):

  d←'bob'
  (1 0 0/d)←'B'
  d
Bob

But the same thing (though expressed with a commute) does not in Dyalog:

  d←'bob'
  (d/⍨1 0 0)←'B'
SYNTAX ERROR
  (d/⍨1 0 0)←'B'
            ∧

and in April:

The value
  #:G2102
is not of type
  LIST
   [Condition of type TYPE-ERROR] 

The limitation in Dyalog is discussed here but I was wondering if April needs to have this limitation?

It sounds like the Dyalog limitation is expressed in terms of tokens as B Wilson says "the name to be assigned must be the rightmost token in the overall left expression." But if the validation was done later in the interpretation process (perhaps once you have a parse tree) then it it could noticed that, when a commute occurs, the textual rightmost token might not be the same as the logical rightmost token.

@phantomics
Copy link
Owner

Interesting idea, I could probably register that given how I compose the assign-by-select syntax. I'll give it a try.

@justin2004
Copy link
Contributor Author

justin2004 commented Jan 7, 2025

@phantomics cool! I'll be interested to hear if the April approach can handle arbitrarily nested commutes. Seems like if you are using the parse tree then it would be possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants