when I define these in j8 repl, it works as I'd want

conj_cat_=: 2 :'v@:u^:a'


   >: conj_cat_ ] 1
9
   >: ^:8 ] 1
9

this is also the 'right' answer:
   >: conj_cat_ ] a
15
   >: ^:8 ] 7
15
   a_cat_=: 2
   >: conj_cat_ ] a
9

The issue is entirely related to accessing variables at time of definition.

> I think you have said that the value of 'a' should be 8 because itmakes no 
> sense for it to be 5. But, it's actually 9.

The a accessed in verb_dog_ should indeed be 9.  For definitions entered in J7 
files within a cocurrent context, the locale for a conjunction is wrong... it 
is the callers.  It is correct for a verb.





----- Original Message -----
From: Raul Miller <[email protected]>
To: Programming forum <[email protected]>
Cc: 
Sent: Saturday, November 16, 2013 8:52:16 PM
Subject: Re: [Jprogramming] bug in conjunction locales?

What do you mean by "execute"?

Consider this example:

   a_cat_=: 8
   a_dog_=: 9
   a=: 7
   conj_cat_=: 2 :'u&.(v inv)'
   verb_dog_=: do bind 'a'
   thingy=: verb_dog_ conj_cat_ %
   thingy 5

I think you have said that the value of 'a' should be 8 because it
makes no sense for it to be 5. But, it's actually 9.

Conceptually speaking, conjunctions are executed multiple times - they
have both "parse time" and "execution time" semantics. And, given your
logic, I think you are talking about their "parse time behavior", not
their "execution time behavior".

Does this distinction sound meaningful to you?

Thanks,

-- 
Raul


On Sat, Nov 16, 2013 at 6:25 PM, Pascal Jasmin <[email protected]> wrote:
> I feel as though conjunctions defined inside a locale should have their 
> current locale state when executed be that locale.  It makes no sense for it 
> to be the caller's.
>
> The reason it is a big issue is that the conjunction may wish to access 
> member data.
>
>
> cocurrent 'myl'
>
> c =: 2 : 0
> smoutput 18!:5 ''
> u v y
> )
>
> v =: 4 : 0
> smoutput 18!:5 ''
> x + y
> )
>
>
>    3  v_myl_ 2
> ┌───┐
> │myl│
> └───┘
> 5
> +:  c_myl_ +: 2
> ┌────┐
> │base│
> └────┘
> 8
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to