Right. So I see I've not used J for far too long. It's indeed only ever used directly, i.e. not in derived verbs.
Thanks Henri! Op za 9 mrt. 2019 om 17:34 schreef Henry Rich <[email protected]>: > Reassigning N affects later execution of mod but not verbs created > previously by mod: > > mod =: 1 : 'N&|@:x' > N =: 5 > > mod5double =: +: mod > > mod5double 4 > > 3 > > N =: 7 > > mod5double 4 > > 3 > > mod7double =: +: mod > > mod5double 4 > > 3 > > mod7double 4 > > 1 > > > Henry Rich > > > > On 3/9/2019 10:32 AM, Jan-Pieter Jacobs wrote: > > Hi! > > > > There's a fairly substantial problem with chapter 32 of FSOJ, as it uses > > this definition for mod: > > > > mod=: adverb : 'n&|@x' > > > > > > Aside the fact that using it as defined yields a domain error (easily > > solved using N instead of n), there is a problem where afterwards the > > article seems to assume that reassigning n (or N) influences mod. > > > > However, it does not (at least in recent J), and would need redefining > mod > > every time a different N is used. > > > > > > Would replacing mod by the following definition be acceptable: > > > > mod =: 2 : 'n&|@u' ? It is then used as (^ mod 10) for modulo 10 > > exponentiation, for instance. > > > > > > What do you think? > > > > Best regards, > > > > > > Jan-Pieter > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > --- > This email has been checked for viruses by AVG. > https://www.avg.com > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
