The list of names is finite, and accessible with reflection tools. That is, ultimately, "inverse" of ". is ". and the inverse of ~ is ~ (both of these statements are wrong, the latter wronger than the former).
Seeing as you're using "variable", I'll take it you're only interested in "reverse-engineering" nouns, and not in other nameclasses (verbs, adverbs, or conjunctions). I'm also going to limit coverage to global names. Local names are also possible, but tricker, and left as an exercise for the reader. sayMyName =: < fqnMatch nounFQN fqnMatch =. ] #~ (= ".&.>) nounFQN =. ([: ; fqn ,&.>&.>~ nounsIn)@:locs fqn =. <@ ,&'_' @: ,~&'_' &.> nounsIn =. [: ".&.> (<":noun) ,&.>~ nlIn nlIn =. 'nl_' ,L:0 '_ ' ,L:0~ ] locs =. conl bind '' sayMyName =: sayMyName f. sayMyName ARGV_z_ +-------+ |ARGV_z_| +-------+ sneakyCopyOfARGV =: ARGV_z_ sayMyName ARGV_z_ +----------------------+-------+ |sneakyCopyOfARGV_base_|ARGV_z_| +----------------------+-------+ Ok, so now you've got it, and you know its limitations. The question is now: why did you want this? What are you going to do with it? -Dan PS: Sorry if the formatting on the code comes out wacky, I'm using a webmail client and it really really hates formatting in free text. On Friday, May 3, 2019, 8:49:55 AM EDT, Devon McCormick <[email protected]> wrote: Based on what Henry says, this means J cannot distinguish between: var=. i.3 'var' -: v var and 'var' -: v i.3 If you are willing to live with false positives, you could do something ridiculous like this: nl 0 +-------+-----+------------+----+------+ |BASEDSK|DBGFL|DEBUGSTARTUP|IFJ6|ISWIN7| +-------+-----+------------+----+------+ var=. i.3 (".&.>nl 0) i. <var 5 #nl 0 6 nl 0 +-------+-----+------------+----+------+---+ |BASEDSK|DBGFL|DEBUGSTARTUP|IFJ6|ISWIN7|var| +-------+-----+------------+----+------+---+ So, v=: 13 : 'x{~(".&.>x) i. <y' (nl 0) v var +---+ |var| +---+ On Fri, May 3, 2019 at 8:30 AM Henry Rich <[email protected]> wrote: > A noun is replaced by its value before the sentence is executed. > > Henry Rich > > On 5/3/2019 8:28 AM, Piet de Jong wrote: > > (This probably shows my ignorance,) but if y is a variable then y points > to some values. I’d like to know “the pointer” rather than "the values”. > I very/extremely vaguely understand these things work on stacks with the > y values loaded on a stack before v gets to act on them. That is why > perhaps I thought it could be an adverb or conjunction: a counterpart to > “evoke” ~. > > > >> On 3 May 2019, at 10:09 pm, Henry Rich <[email protected]> wrote: > >> > >> Impossible - v never sees y, only its value. > >> > >> Henry Rich > >> > >> On 5/3/2019 6:58 AM, Piet de Jong wrote: > >>> If m is the name (ie string) of a variable then ‘m'~ is the value of > the variable. > >>> > >>> Is there an “inverse" to this? > >>> > >>> That is I want a verb v (or adverb or conjunction) so that if y is a > variable then > >>> > >>> v y > >>> > >>> is the name (ie string) of the variable. > >>> > >>> > >>> > >>> > >>> ---------------------------------------------------------------------- > >>> 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 > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Devon McCormick, CFA Quantitative Consultant ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
