I have come across this before and solved it by explicitly referencing the verb 
fun in the adverb:

  cocurrent 'N1'
   
  fun =: 3 : 0
       2*y
)
   
  A =: 1 : 0
        u fun_N1_ y
)
  cocurrent 'base'
  *: A_N1_ 5
100

> From: Matthew Brand
> 
> Thanks, will try it.
> 
> Does anybody know a better solution though because this could lead to
> name clashes in a polluted z locale.
> 
> 2009/9/15 bill lam:
> > On Tue, 15 Sep 2009, Matthew Brand wrote:
> >> Does anybody know how to make this work? I have an adverb A defined
> in
> >> a locale N1 which references the function "fun" which is also in
> that
> >> locale, but it is called from 'base' as A_N1_ ... How come it cannot
> >> find the verb "fun"? I expected the result to be 100, i.e. *: 2 * 5.
> I
> >> thought that J switched to the locale _N1_ and then executes the
> >> adverb?
> >>
> >> Thanks,
> >> Matthew.
> >>
> >>   cocurrent 'N1'
> >>
> >>   fun =: 3 : 0
> >>        2*y
> >> )
> >>
> >>   A =: 1 : 0
> >>         u fun y
> >> )
> >>
> >>   cocurrent 'base'
> >>   *: A_N1_ 5
> >> |value error: fun
> >> |   u     fun y
> >
> > I guess it is a design feature that automatic locale switching only
> > works for verb. You may try
> >
> >  cocurrent 'base'
> >  coinsert 'N1'
> >  *: A 5
> >
> > or write the 'fun' in z locale

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

Reply via email to