Named verbs are passed by name, to explicit conjunctions and adverbs. You can use f. to eliminate names from the definition.
If you only want to eliminate the name 'f' instead of all names, you can use: ((5!:1<'f')5!:0) as the argument to your conjunction. This will extract f's definition and use that. This approach can be valid in utilities that want to inspect the names used in a definition. But note that this approach loses track of the locale the name existed in. That said, note also that the names 'u' and 'v' are special and are automatically dereferenced for you. -- Raul On Fri, May 4, 2012 at 4:56 PM, Paul Jackson <plj...@gmail.com> wrote: > I've been rewriting some of my APL tools in J. I wrote a Conjunction to > provide keyword in context. Its arguments are: > [x=. defaults to Width] > m=. 'look' > v=. FindFunction > y=. 'text to look in' > > While writing updates to my tools, I decided to provide a constant function > that returned where two recent scripts first changed. I was suprised that > this version (highly simplified) got a value error. > > Foo=: 3 : 0 > f=. 4 : '123' > (y Context f old), y Context f new > ) > > Foo'' > |value error: f > | ,.<"1((m v y)+/i:x){(x+#y){.y Replace LF;20{a. > > Either making f global, or including (4 : '123') inline fixed the problem. > But I was curious why things didn't work as I would have expected. I had > assumed that verbs would be passed by definition and local vs global > wouldn't matter just as with nouns. > > After a bit of testing I've confirmed that passing the local function as v > works. Was this known? > > Goo=: 3 : 0 > v=. 4 : '123' > (y Context v old), y Context v new > ) > > Paul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm