Current issue

Vol.26 No.4

Vol.26 No.4


© 1984-2017
British APL Association
All rights reserved.

Archive articles posted online on request: ask the archivist.


Volume 15, No.4

Challenge: “Design a Utility to Produce a Function Calling Tree under Dyalog APL/W”

issued by Ray Cannon

One of the first utilities I wrote under Dyalog APL/W produced a calling tree for a specified function. Use of the Dyalog system function ŒREFS makes the task easy, and this formed the basis of the code used in the “UCMD” utility “COPYUTILS” (see UCMD).

However, this code was written before namespaces were introduced, and now needs to be updated to take them into account.

The challenge then is to write a utility that, given the name of top function as its argument, returns a list of all the functions called from that point down (including the top function).

It should be able to handle simple explicit calls to functions in other namespaces (via the <name space path>.<fn name> syntax), but cannot be expected to handle run time variable calls (e.g. Function name resolution via the ŒPATH system function, or via either the monadic or dyadic execute).

Each name in the calling tree should be qualified with its namespace path, either relative to the top function or as an absolute path. By this I mean that if the top function argument is AA and it calls BB and UTIL.CC, and BB calls #.ZZ the result would be:


If the argument was given as, then the result would be

It must be able to handle recursive calls and should only list a called object once.

The main problem I have had in trying to write this code is that the ŒREFS system function can no longer be used as it does not treat a function name (which includes namespace path information) as a single reference. Thus for example, a call “” produces two references “app” and “BB”, and it cannot differentiate between calls to “#.app1.BB” and “#.app2.BB”.

The best solution(s) received will, I hope, be published in a future issue of Vector and incorporated into the UCMD code available from

© 1999 British APL Association

script began 1:30:49
caching off
debug mode off
cache time 3600 sec
indmtime not found in cache
cached index is fresh
recompiling index.xml
index compiled in 0.2977 secs
read index
read issues/index.xml
identified 26 volumes, 101 issues
array (
  'id' => '10013900',
regenerated static HTML
article source is 'HTML'
source file encoding is 'ASCII'
read as 'Windows-1252'
URL: ../ucmd.htm => trad/v154/../ucmd.htm
completed in 0.3263 secs