Thanks Dan that's fantastic! Especially the step-by-step building. Would be worth putting up on the Wiki as a guide?
If you don't see yourself getting around to it, let me know and I'd be happy to do it as pay back for your time. Ric > -----Original Message----- > From: [email protected] [mailto:programming- > [email protected]] On Behalf Of Dan Bron > Sent: Wednesday, 24 November 2010 13:15 > To: 'Programming forum' > Subject: Re: [Jprogramming] A phrase for amendment > > Ric wrote: > > I would probably just define the verb > > directly including the monad: > > If I don't know how to approach a problem tacitly, I'll define it explicitly > first: > > 1 : 'u@:{`[`]}' > > This has the benefit of not baking in an argument (hence, reusability), but > it also will help me work my way towards a tacit solution, as we'll see. > > > if you have a tips on how you > > went about composing your adverb > > I'd be interested. > > Sure. Come on over to the dark side. > > The first step towards building a tacit adverb is knowing exactly what you > want as a result. In this case, we want u...@{`[`]} . If you don't have a > clear picture of what you want, building the solution explicitly first can > help, as I said. > > Given a clear goal, and a few techniques, building a tacit adverb is > actually a fairly mechanical process (hmm, maybe I can make an 11 : '...' ) > . Some techniques are: > > - a tacit adverb is an adverb train - that is, > it is composed solely of adverbs. > > - normally those adverbs are either primitives, > like / or bound conjunctions like (@{) > > - the argument comes in from the left, so you > start modifying it there. > > - for verb arguments, normally you either want > to compose them with other verbs, or you want > to produce a train. > > - adverbs which produce composed verbs are > easy to write, if you want (u conj > something) you write (conj something), > and if you want (something conj u) you > write (something conj). > > That's the beauty of tacit code - the > missing arguments are so "obvious", > it's almost like writing "fill > in the _____s." > > - adverbs which produce verb trains aren't > quite as clean, but they're still easy > and mechanical, and leverage the rule > above and the utility (`:6). By definition, > (f`g`h`i`j) `:6 produces (f g h i j) so > if you want to produce that train given f, > then you just write (`g)(`h)(`i)(`j)(`k)(`:6) . > Similarly, if you wanted to produce > (v0 f v1) given f, you'd write (v0`)(`v1)(`:6) . > > - when in doubt, parenthesize. > > - work iteratively, in small pieces: > > - Given f, I want g f"2&.>/@:(,&<) h . > > - OK, let me write an adverb that > produces f"2 given f : ("2) > > - OK, let me write an adverb that > produces f1&.> given f1=.f"2 : (&.>) > > - OK, let me write an adverb that produces > f2/ given f2=.f1&.> : / > > - OK, let me write an adverb that produces > f3@:(,&<) given f3=.f2/ : (@:(,&<)) > (or in two steps: (@:,) (,&<) ) > > - OK, now I need a train g f4 h given > f4=. f3@:(,&<) : > > - g will come to the left of f4 in the > train, so: (g`) > > - h will come to the right of g and f4 in > the train, so: (`h) > > - OK, now I've got my gerund, so let me > evoke it as a train: (`:6) > > - OK, a tacit adverb is just a train of adverbs, > so let me collect all my pieces in order: > > adv =. ("2) (&.>) / (@:(,&<)) (g`) (`h) (`:6) > > f adv > g f"2&.>/@:(,&<) h > > See? Quite mechanical. Now, it can get more advanced than this, > particularly through the manipulation of atomic representations. > > I won't get into that here, except to note that (`'') is an anonymous tacit > adverb that will produce the atomic rep of its verb argument (well, the > ravel of the a.r. of its verb argument), and once you have that, you can use > normal tacit verbs to manipulate it to taste, then evoke it later with 5!:0 > . In some sense, (`'') is analogous to ("_) . > > If you want to get really advanced and fancy: > > - recognize that *everything* has an atomic > representation (heh: Ambrus once found an > atomic rep that was _its own atomic rep_). > > - get familiar with the definition of @. > having a boxed noun RHA. > > -Dan > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
