loadd 'D:\JUser\temp\195.ijs' message=:(i.0 0)[1!:2&2 adv1=:1 : 0 message 'Adverb 1 run' u/ ) adv2=:1 : 0 message 'Adverb 2 run' u/y ) message 'After definitions' After definitions d1=:+adv1 NB. Use with no x or y. Adverb 1 run d1 1 2 3 NB. Using d1 referring to adv1. 6 d1 +-+-+ |+|/| +-+-+ d2=.+adv2 NB. Defining with u only. adv2 does not run yet. d2 1 2 3 NB. Using d2 referring to adv2. Now adv2 runs. Adverb 2 run 6 d2 +-+----------------------------+ |+|+-+-+----------------------+| | ||1|:|message 'Adverb 2 run'|| | || | |u/y || | |+-+-+----------------------+| +-+----------------------------+
d1 and d2 do the same thing; however, notice when adv1 and adv2 are executed and the difference in the definitions of d1 and d2. On Fri, Jun 10, 2011 at 8:51 AM, David Vincent-Jones <[email protected]>wrote: > If the definition could be terminated with a 'special' symbol, that > detects the problem, then an automatic error message might be generated > as in "x input incorrect or missing". It would be a more user friendly > than having users delve into the land of trace. > > David > > On Thu, 2011-06-09 at 20:09 -0600, Don Guinn wrote: > > I don't really know. All I know is that if I have x and y explicitly > > specified in the definition of an adverb or conjunction that it does not > > appear to execute until x and y are supplied. You can see that by putting > a > > trace, some output which occurs when the definition is executed. If no x > or > > y it executes earlier. If x or y is present it waits until x and/or y are > > given. You can put tests into the definition to determine if u and v are > > verbs or nouns. You can put in tests to look at x and y and change how > the > > adverb or conjunction executes. That seems to me that the execution is > > deferred when x or y is present. > > > > It would seem to me that if trace were in the definition that that would > > show even if the definition were discarded. > > > > On Thu, Jun 9, 2011 at 8:08 AM, Raul Miller <[email protected]> > wrote: > > > > > You are talking about two different things here, I think. > > > > > > An evaluation step has to happen (which involves resolving what the > > > name of the conjunction refers to) before the interpreter can see > > > whether it contains both an x or a y and a m, n, u or v. > > > > > > Now... you could argue that once that investigation has happened, the > > > definition which was inspected should be discarded, and the name which > > > was used to find the definition should be retained in its place. But > > > I think we can at least agree that this would be a change in how the > > > language works: > > > > > > f1_ex_=:1 :'start u y' > > > f2_ex_=:1 :'start u ]' > > > start=: 10 > > > start_ex_=: 100 > > > + f1_ex_ 1000 > > > 1010 > > > + f2_ex_ 1000 > > > 1100 > > > > > > -- > > > Raul > > > > > > On Thu, Jun 9, 2011 at 8:53 AM, Don Guinn <[email protected]> wrote: > > > > Not necessarily. The definition is completed when all arguments are > > > > supplied. If the definition of an adverb or conjunction contains x > or y > > > the > > > > definition is delayed until those arguments are supplied. > > > > > > > > On Thu, Jun 9, 2011 at 12:40 AM, Ian Clark <[email protected]> > > > wrote: > > > > > > > >> >>Anyways, adverbs and conjunctions are evaluated when building > tacit > > > >> >>verbs, so J cannot defer their name resolution until later unless > you > > > >> >>embed them in an explicit verb. > > > >> > > > > >> > Thanks, Raul -- I guess that perfectly describes the situation > I've > > > >> > run up against. :) > > > >> > Plus the remedy, which is the one I've resorted to. :/ > > > >> > But IMO that's like Molière: Q: Why does morphine make you > sleep?... > > > >> > > > >> Sorry Raul, I entirely missed the point, didn't I? ... > > > >> > > > >> If adverbs and conjunctions combine verbs into new verbs, then those > > > >> new verbs logically come into existence at definition time, not > > > >> run-time. Hence the conjunction has to be expanded at definition > time: > > > >> you can't avoid it. > > > >> > > > >> Very taken-up right now with clearly explaining J concepts to > novices. > > > >> Seems I needed this one explaining to myself: I was implicitly > viewing > > > >> a conjunction as a kind of super-verb taking extended arguments. > > > >> > > > >> Definitely an APL mindset there > > > >> . > > > >> > > > >> > > > >> > > > > > ---------------------------------------------------------------------- > > > > 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 > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
