selective assignement doubt
6 posts
• Page 1 of 1
selective assignement doubt
Hi, I have a doubt here:
x←0 0 0
b←1 0 1
(b/x)y←(3 4)5
SYNTAX ERROR
but
((b/x))y←(3 4)5
works
I don't understand why we need the second set of brackets. please enlighten me, thank you :)
x←0 0 0
b←1 0 1
(b/x)y←(3 4)5
SYNTAX ERROR
but
((b/x))y←(3 4)5
works
I don't understand why we need the second set of brackets. please enlighten me, thank you :)
- gumont68
- Posts: 4
- Joined: Fri Oct 19, 2018 10:22 am
Re: selective assignement doubt
I should say that it's quite simply a bug.
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: selective assignement doubt
Although you'll find plenty of folks who'd say you should need parens about the entire left hand side
((b/x)y)←(3 4)5
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: selective assignement doubt
Thank you Phil for you answer.
I agree that the need of extra brakets could be a bug.
But having brakets around the whole expression gives yu a value error if y is not already existing:
((b/x)y)←(4 5)10
VALUE ERROR: Undefined name: y
((b/x)y)←(4 5)10
This to me looks fine, because I guess that having y in brakets forces the interpeter to evaluate it before assigning a new value.
I agree that the need of extra brakets could be a bug.
But having brakets around the whole expression gives yu a value error if y is not already existing:
((b/x)y)←(4 5)10
VALUE ERROR: Undefined name: y
((b/x)y)←(4 5)10
This to me looks fine, because I guess that having y in brakets forces the interpeter to evaluate it before assigning a new value.
- gumont68
- Posts: 4
- Joined: Fri Oct 19, 2018 10:22 am
Re: selective assignement doubt
I think you are being generous in giving Dyalog a nice excuse for this.
I suspect that both problems are merely holes in the testing regime that just happen to have been overlooked because of a lack of necessity or invention by developers and users in the time since development and implementation respectively - or, if ever these expessions worked, since the bugs were introduced.
There seems to be nothing in the documentation that should prohibit their evaluation.
I suspect that both problems are merely holes in the testing regime that just happen to have been overlooked because of a lack of necessity or invention by developers and users in the time since development and implementation respectively - or, if ever these expessions worked, since the bugs were introduced.
There seems to be nothing in the documentation that should prohibit their evaluation.
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: selective assignement doubt
We have attempted to document the various forms of assignment that are supported by Dyalog APL. To summarise:
- Plain e.g name←value
- Distributed e.g. (name1 name2)←value and (but not recommended) name1 name2←value
- Selective e.g. (1 0 1/name)←1 2
- Indexed e.g. name[index]←value
- Modified e.g. name+←value
- Selective Modified e.g. (⊃name)+←value
- Indexed Modified e.g. name[index]+←value
- Code: Select all
i←2
x←0 0 0
x[i] y←3 4
⍝ But:
(x[i] y)←3 4
SYNTAX ERROR
(x[i]y)←3 4
∧
-
Morten|Dyalog - Posts: 453
- Joined: Tue Sep 09, 2008 3:52 pm
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group