4,505
edits
(→IBM) |
|||
Line 20: | Line 20: | ||
ns(⍎container.⎕NS)←⍬ | ns(⍎container.⎕NS)←⍬ | ||
</source> | </source> | ||
Avoiding the unusual [[modified assignment]] (using | Avoiding the unusual [[modified assignment]] (using the 2-[[train]] <source lang=apl inline>⍎⎕NS</source> as modifying function) helps: | ||
:<source lang=apl inline> | |||
ns←ns container.(⍎⎕NS) ⍬ | |||
</source> | |||
Finally, splitting the 2-train apart makes it even clearer: | |||
:<source lang=apl inline> | :<source lang=apl inline> | ||
ns←⍎ns container.⎕NS ⍬ | ns←⍎ns container.⎕NS ⍬ | ||
</source> | </source> | ||
A new [[namespace]], with the original value of <source lang=apl inline>ns</source> as name, is created inside <source lang=apl inline>container</source> and the character representation <source lang=apl inline>'#.container.ns'</source> is returned from <source lang=apl inline>⎕NS</source> to <source lang=apl inline>⍎</source> which evaluates the name to a reference, that in turn replaces the previous value of <source lang=apl inline>ns</source>. |