Donn wrote:
> would be nice if debug could be extended to handle the anonymous
> definitions.
I agree.
But, until this is changed (if ever), an easy solution is to simply name the
anonymous functions. You can then modify them as you please (adverse, under,
rank, etc), and name the result, producing a debuggable entity equivalent to
the original.
Unforunately, this uglifies code a bit. For example, to debug-enable the
definition:
original =: (verb define)&>
x+y
)
one cannot simply say:
debuggable =: (inner =: verb define)&>
x+y
)
because copulae are transparent (they produce their referents), so:
debuggable NB. NOT debuggable
3 : 'x+y'&>
the inner verb is still anonymous. If it doesn't bother you, you can use
another line:
inner =: verb define
x+y
)
debuggable =: inner&>
If it does bother you, you can use a cover function for =: , similar to
Raul's yesterday:
ann =: 2 : ('(u) =: v';'u~')
and then have syntax similar to the first attempt (the one with inline copulae):
debuggable =: 'inner' ann (verb define)&>
x+y
)
debuggable
inner&>
Once again, if you promise that the name you want to give to the inner function
is previously unused or a proverb (which is more reasonable in the case of
assigning verbs), you can use a conjunction similar to the one I posted
yesterday:
an =: 2 : ('({. u`[ ) =: v';'u')
which permits the slightly more elegant:
debuggable =: inner an (verb define)&>
x+y
)
debuggable
inner&>
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm