Page 1 of 1

I have probably forgotten something, but...

Posted: Sat Jul 30, 2022 1:42 pm
by crishog
Take

r←'Resources'#.⎕NS''
Resources.x←1
r.y←1
SYNTAX ERROR
r.y←1

r
#.Resources

Just wondering why I get the syntax error

Re: I have probably forgotten something, but...

Posted: Sat Jul 30, 2022 8:13 pm
by kai
You intuitively assumed that
      r←'Resources'#.⎕NS''

assigns a reference to "r", but it's rather a name.

Instead
      r←⍎'Resources'#.⎕NS''

does the trick.

Or you do it this way:

      Resources←⎕ns''
Resources.x←1
Resources.y←1

Re: I have probably forgotten something, but...

Posted: Sun Jul 31, 2022 9:46 pm
by crishog
Whereas monadic quad NS does return the anonymous namespace. The result is not as consistent as I thought

I meant to type

Resources <- []NS ''

Sorry no APL keyboard at the moment

Re: I have probably forgotten something, but...

Posted: Mon Aug 01, 2022 4:16 pm
by kai
Yes, it's not consistent, but there's a reason why:

1. When ⎕NS was introduced, references weren't yet available in Dyalog.

2. With anonymous namespaces on the other hand there is no name, so it can only return a reference.