This was a simplified version of my problem.

I reality I am calling the adverb as:

A__f

where f =. <'N1'

So I cannot write fun__f explicitly.

I thought about Bill's solution some more and it does not help because
in reality my "fun" references nouns and verbs in the N1 locale, I
cannot put them all in _z_ because there are several other locales N1,
N2 etc... that are like N1 but have slightly different noun contents.




2009/9/15 Sherlock, Ric <[email protected]>:
> 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



-- 
The risk is socialized, the profit is privatized.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to