I wrote:
> (a f a g a h b) -: a ([ f [ g h) b
David Ward Lambert wrote:
> perhaps something like a F G H b
> works where F G H are correct part
> of speech related to f g h?
Are you asking because you want the shortest possible equivalent expression
(maximal abbreviation), or the "tacitest" possible equivalent expression
(minimal references to the arguments)?
If the former (shortest possible expression), then the answer is I don't
believe that you can get an expression equivalent to the original in fewer
chars (or words).
Of course, you could define a name (say, an adverb) that consumes the train
(f g h) and produces ([ f [ g h), so that you could write a(f g h)U b in
fewer chars than a f a g a h b . But the chars consumed in defining U
would more than outweigh the savings (at least for one use of U ).
But I think you're asking more about clarity of expression, rather than
economy. That is, you want to minimize the number of references to the
arguments, and here, the verb [ "feels" just as redundant as the noun a ,
right?
Put another way, using [ here feels like we're simply avoiding the question
of "abbreviating" in the first place; sure, we've abstracted away from the
specific value of a, or the name a, but we could've achieved that with 4 :
'x f x g x h y' . Surely tacit code can do better. Isn't that what
trains are for, to let arguments just "fall into place"?
Ambrus asked:
> Dan, is this one of the cases where you can't avoid the brackets
> with forks and tildes and similar things?
I'm glad of David's question, because it's a sterling example of the reason
I'm drawn to hooks and tildes and similar things, which I've had trouble
justifying in the past.
In fact, if we only had one noun, a (and so h were a monad), I would be very
tempted to write:
(f (g h)) a NB. Nested hooks
or, at the very most,
(f ] g h) a NB. Fork nested in hook
to save a character (at the expense of a single explicit reference to a ).
But the trouble is that in this case, the rightmost (and therefore first)
verb, h, needs to be applied dyadically. That is, it needs access to both
arguments [1]. That means that we can't use hooks, because hooks
intentionally hide one argument from their right tines.
So, since we can't hide the left argument from h, we can't use the hook (g
h). So we're required to add a [ and use [ g h . But furthermore, since (f
[ g h) is a hook, with [ g h its right tine, it would hide its left argument
that fork, and therefore from h, so we can't use that form either; we're
required to add another [ resulting in ([ f [ g h) .
Make sense?
-Dan
[1] Note that it's the requirement for h to see *both*
arguments that's the showstopper; don't confuse that
with the requirement for h to see the left argument.
If h only needed to see the left argument (but not
the right), we could still use a hook, combined with
some tildes. In fact, that's what I'm doing when
you see me peppering hooks with tildes: referring to
the left argument, while avoiding the identity verbs.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm