[Jprogramming] why won't this work (bug in :: ?)
bill lam
bbill.lam at gmail.com
Sun Jun 22 13:46:00 UTC 2014
I think this is a feature, not a bug. ( I assume you meant :. obverse)
On 22.06.2014, at 10:29, "'Pascal Jasmin' via Programming" <programming at jsoftware.com> wrote:
> 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 <programming at jsoftware.com>
> To: "programming at jsoftware.com" <programming at jsoftware.com>
> 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 <programming at jsoftware.com>
> To: Programming forum <programming at jsoftware.com>
> 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
More information about the Programming
mailing list