I said explicit because I was thinking that if there were such a function, call it 4!:x, that a definition like
whoami =: 4!:x would mean that whoami'' would be useless, as it would always return 'whoami'. However, I can well see that there would be value in having the function available in a named tacit definition, such as form_ctlxx_button =: form_ctl_button@:(4!:x) I think I would vote for giving the name of the current defn (even if tacit), but then I don't like cover functions anyway. I have no opinion on what the result should be if the current defn is anonymous. An empty string is OK with me. Henry Rich > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Roger Hui > Sent: Tuesday, January 23, 2007 5:20 PM > To: Programming forum > Subject: Re: [Jprogramming] Is there a 'Who am I' function? > > The interpreter has an internal "curname" variable > that could be made available as a new 4!:x . But > before I contemplate that, let me ask: > > - What happens when the current defn is anonymous? > e.g. what is the result of 3 : 'whoami' > > - Why the name of the current explicit defn? > Why not the name of the current defn? > > > > ----- Original Message ----- > From: Henry Rich <[EMAIL PROTECTED]> > Date: Sunday, January 21, 2007 2:06 pm > Subject: Re: [Jprogramming] Is there a 'Who am I' function? > > Doing user interfaces I often find myself with several buttons that > point to the same underlying function with different arguments, like: > > scoreboard_timer0_button =: timer_start@({&timer_buttontimes)@0: > scoreboard_timer1_button =: timer_start@({&timer_buttontimes)@1: > scoreboard_timer2_button =: timer_start@({&timer_buttontimes)@2: > scoreboard_timer3_button =: timer_start@({&timer_buttontimes)@3: > scoreboard_timer4_button =: timer_start@({&timer_buttontimes)@4: > etc... > > > I could save quite a bit of bulk if I could come up with an > expression, > call it > > whoami > > which would return, as a character string, the name of the > explicit definition > it is running in. > > I emphatically DO NOT want for whoami to require that debug > be turned on. > > I have been defeated. Any winners? > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
