On Mon, Jan 26, 2009 at 6:30 PM, Sherlock, Ric
<[email protected]> wrote:
> Is there a way to list names within an explicit verb that are local to that 
> verb?
>
> Myverb=: 3 : 0
>  a=. 'hello'
>  b=. 3 4 2 9
>  c=. 'big';'little';30 2
>  NB. Expression to List names defined locally to this verb
>  NB. (i.e. the list: 'a';'b';'c')
>  Localnames=. <ListLocalNames>
>  pack Localnames
> )

This is not completely general, but most verbs do not
use constructs like ". or (expr)=. to generate arbitrary names:

   verbnames=: ~.@(#~ 1 |. =&(<'=.'))@;:@( 5!:5)@ <
   verbnames 'Myverb'
+-+-+-+
|a|b|c|
+-+-+-+

> Given the missing expression <ListLocalNames> the verb would return
>   Myverb ''
> +-+-----------------+
> |a|hello            |
> +-+-----------------+
> |b|3 4 2 9          |
> +-+-----------------+
> |c|+---+------+----+|
> | ||big|little|30 2||
> | |+---+------+----+|
> +-+-----------------+

To get the values you should run the verb and use debugging features
(13!:n).  The approach I used to pick out names would not be good,
because most verbs do use arbitrary calculations for computing
values.

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to