From:  August Karlstrom <fusionfile@gmail.com>
Date:  22 Feb 2020 19:55:13 Hong Kong Time
Newsgroup:  news.alt119.net/comp.lang.apl
Subject:  

Accessing table columns by name

NNTP-Posting-Host:  B7HvuE1YZTrBRAECuu2n9A.user.gioia.aioe.org

If I have a table of N columns and I want to access individual columns 
by name (instead of index), what is the best practice in this case? I 
could define the column names alongside the table, like for example

	employees ← 0 3 ⍴ ⍬
	(nameCol phoneCol addressCol) ← ⍳3

The problem with this approach is that the scope of the column names is 
too large; I may have another table in the same scope which also has a 
"name" column. To solve this problem I could define a namespace (using 
Dyalog APL's function ⎕NS) and define the elements and the column names 
inside it, but then accessing the column names is more verbose since 
they need to be prefixed with the namespace. Any ideas? How do you write 
maintainable APL programs involving tables?

By the way, are there any documents available online with best practices 
for programming in the large with APL? All articles I have read about 
APL is more or less focused on using it as an advanced calculator.


Regards,

August