fa is an explicit definition, and d is not defined inside it. d is local to MN.
I really wish that there were some way for modifiers to refer by name to private variables in the calling definition. But there's not (before J5 you could get around the problem). For this case, make fa a conjunction and pass d in as an operand. Henry Rich > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of June Kim > Sent: Monday, September 25, 2006 12:51 PM > To: Programming forum > Subject: [Jprogramming] Local vs. Global (was Re: Base Conversion) > > MN=: dyad define > 'M N'=.x > d=.'0123456789ABCDEF' > fa=. 1 : 'm&#.@(d&i.)' > fromM=.M fa > toN=.N fa^:_1 > toN fromM y > ) > > 16 2 MN 'FF' > |domain error: fromM > | toN fromM y > > It works when "d" in MN is defined as global with =:. Why does it have > to be defined globally? > > 2006/9/26, June Kim <[EMAIL PROTECTED]>: > > Hello > > > > Base M and N are given, which are any integer number > between 2 and 16 > > inclusive. Do the base conversion on a given number(in string form) > > from base M to base N. > > > > My quick trial follows: > > > > d=:'0123456789ABCDEF' > > fromM=: [ #. d i. ] > > toN=:d {~ 13 : 'x&#. ^:_1 y' > > MN=: ([: {: [) toN ] fromM~ [: {. [ > > > > 16 2 MN 'FE' > > 11111110 > > 8 16 MN '732' > > 1DA > > > > > > Could you propose a pure tacit version, or more elegant, > shorter one? > > I bet there are better ones than mine, as always. > > > > June > > > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
