Here is the related bug (IMO) in .:

.: does not execute the inverse in the correct locale

a__n = 0 [ n =. 18!:3 ''

   aset__n =: (][ (3 : 'a =: 1')) :. (][ (3 : 'a =: 0')) 
   aset__n 2 
2 
   a__n 
1 
   aset__n inv 2 
2 
   a__n 
1  NB. should be 0
   a 
0
   erase 'a' 
1 
   aset__n inv 2 
2 
   a 
0
 

I guess this is part of the general issues with adverbs in locales (:.v) is the 
adverb, which I understand is needed for adverbs defined in z to work 
elsewhere, but this affects the usefulness of :. and :: .




----- Original Message -----
From: 'Pascal Jasmin' via Programming <[email protected]>
To: "[email protected]" <[email protected]>
Cc: 
Sent: Saturday, June 21, 2014 1:18:27 PM
Subject: Re: [Jprogramming] why won't this work (bug in :: ?)

Here is a workaround that is probably nicer anyway,

chkerrA_z_ =: (hook ;)(hook }.)(^:(0 = >@{.@:]))
boxeach_z_=: ,&<
mkerr_z_=: ((0&boxeach)@:) ( :: ((13!:11 ; 13!:12)@:(''"_)))

mode_z_ =: 2 : '([: ]chkerrA [: v inv  u mkerr hook v)'

still don't understand why first version fails.





----- Original Message -----
From: 'Pascal Jasmin' via Programming <[email protected]>
To: Programming forum <[email protected]>
Cc: 
Sent: Saturday, June 21, 2014 11:58:44 AM
Subject: [Jprogramming] why won't this work (bug in :: ?)

mode_z_ =: 2 : '([: v inv u hook v) finallyC (v inv) '  NB. v y must return y
finallyC_z_ =: 2 : 'u :: ((v)][:13!:12(''''[]))
hook_z_ =: 2 : ('u v y' ;':';'x u v y')


plus =: +
bizmode =: (3 : 0 :. (3 : 0)) 
plus =: + 

y 

) 
plus =: * 
y 

)

this works as intended:  mode switches definition of plus, then switches back 
after executing u

   3 plus mode bizmode 3
9 

   plus
+
The bug is in finallyC, (::) .  I'd expect that if there is any error in u, it 
should execute v, but:

   3 +: mode bizmode 2 
|domain error 
|   3    +:mode bizmode 2 
   plus__a 
* 

Is the problem that hook is an explicit conjunction?

----------------------------------------------------------------------
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