Getting Names in Namespace in Order of Assignment
5 posts
• Page 1 of 1
Getting Names in Namespace in Order of Assignment
⎕Nl returns things in alphabetical order.
Is there any way to retrieve the the names in a namespace in the order in which they were assigned?
If not, internally, how are the names in the symbol table stored? I would hazard a guess they are stored in some sort order related to assignment.
Is there any way to retrieve the the names in a namespace in the order in which they were assigned?
If not, internally, how are the names in the symbol table stored? I would hazard a guess they are stored in some sort order related to assignment.
- paulmansour
- Posts: 420
- Joined: Fri Oct 03, 2008 4:14 pm
Re: Getting Names in Namespace in Order of Assignment
I'm afraid not .. the names are held in a binary tree, in the same order that Grade uses, so is different in Unicode and Classic editions.
-
AndyS|Dyalog - Posts: 257
- Joined: Tue May 12, 2009 6:06 pm
Re: Getting Names in Namespace in Order of Assignment
Ok, thanks Andy.
I'm trying to impose order on the names in a namespace (for presentation, not computation). Order of assignment is usually how I want it. By hook and crook I can determine that order most of the time, but there are times when can't. I guess I will have to settle for explicitly assigning the ordering.
I'm trying to impose order on the names in a namespace (for presentation, not computation). Order of assignment is usually how I want it. By hook and crook I can determine that order most of the time, but there are times when can't. I guess I will have to settle for explicitly assigning the ordering.
- paulmansour
- Posts: 420
- Joined: Fri Oct 03, 2008 4:14 pm
Re: Getting Names in Namespace in Order of Assignment
There isn't a way to report this after the fact, but if you are sufficiently keen, in v16.0 you can roll your own solution using the extended Trigger mechanism which is designed for implementing various forms of data binding:
- Code: Select all
NS←⎕NS ''
NS.⎕FX'LogAssignments arg' ':Implements Trigger *' '⎕←arg.Name'
NS.life←42
life
-
Morten|Dyalog - Posts: 453
- Joined: Tue Sep 09, 2008 3:52 pm
Re: Getting Names in Namespace in Order of Assignment
Thank you for the hint. That is really cool!
That Seems to be mentioned now as "Global Triggers" in the most recent version of the Programming Reference Guide, dated Aug. 10th., to be found on the web site.
That Seems to be mentioned now as "Global Triggers" in the most recent version of the Programming Reference Guide, dated Aug. 10th., to be found on the web site.
-
JoHo - Posts: 37
- Joined: Sat Nov 28, 2009 12:51 pm
- Location: Austria, EU
5 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