Improper Behaviour From Arrays of Objects?

Writing and using Classes in Dyalog APL
User avatar
Phil Last
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: Improper Behaviour From Arrays of Objects?

Post by Phil Last »

I wouldn't object to a length error on
      (1⍴n).f'this'
but for my money I'd sooner see it stay the way it is than have
      (1⍴n).f
behave like
      (⍬⍴n).f
and please don't think of adding significance to redundant parentheses!
Erik.Friis
Posts: 66
Joined: Mon Apr 04, 2011 3:16 pm

Re: Improper Behaviour From Arrays of Objects?

Post by Erik.Friis »

Phil,

Well the parentheses seemed like a reasonable way out of this mess - by APL2 standards I'm not sure they are redundant:

I know Dyalog allows:

a b c←5

but in APL2 you would need to specify the assignment as:

(a b c)←5

The parentheses are not redundant -- a notation I much prefer, but I see your point in this case.

I guess my point is if we are carrying on with the original 50-year old mistake of treating a 1-element vector the same as a scalar, then it should hold true for the dot notation as well or we should dispense with it here. As the language advances, this original gaff becomes bigger and more difficult to program around:

(⍳,5)≡⍳5
1
Post Reply