>  What if we had a hook conjunction?  Would that not make hooks
>  clearer and easier to recognize than currently?

That possibility is discussed in some of the links I provided.  I personally 
don't find:

    pos =. #~ h. (0 <])

prettier than the current:

    pos =. #~ 0 <]

The only situation I can think of that  h.  would be superior would be in long 
trains where the rightmost is a hook:

    f0 f1 (f2 f3)

Right now, as you can see, I have to enclose my hook in parens, which makes it 
longer and more jarring.  With  h.  I could avoid those

    f0 f1 f2 h. f3

Subjectively, I find this less jarring.  But it's certainly no shorter.  And it 
has absolutely no advantages over its fork equivalent:

    f0 f1 ] f2 f3

which is the least jarring and shortest of our options.  If we were to 
eliminate hook, I'd say forgo the conjunction and just force people to write 
the fork  ] g h  .

Which goes to the reason I often prefer hooks:  I personally don't like seeing 
too many [  or  ]  .  One of the reasons I like tacit programming is that it 
doesn't even name its arguments; it is a pure definition.  With  avg=:+/%#  we 
simply define  avg  to be the average.  We don't say what it is the "the 
average OF".   This is a hard concept to express (do you know any good articles 
on declarative vs imperative languages, or point free coding?)

Anyway, a few [] is fine; because then they're just "identity functions", equal 
in standing to  -  or  #  .  But once you start peppering your verbs with them, 
they start becoming stand ins for argument names; essentially replacements for  
x y  .  I see no reason to "go tacit" if you're going to write your verbs this 
way.

I do concede that the contortions required to avoid  []  completely make tacit 
code hard to follow, read, and maintain.  Lots of  ~  switching things around 
is confusing, and lots of  ()  interrupt the flow (hey, that's why we have  [:  
).  But there is a middle ground, and hooks help you get there.

Anyway, this entire discussion is predicated upon having a better definition 
for the 2-train (verb bident).  If you don't like hook, don't use it.  But, 
unless you have a better use for its syntax, let me keep it.  The only current 
contender is  f@:g  .  This is of limited utility;  (f0 (f1 (f2 (f3)))) is no 
better than  f1@:(f2)@:(f3)@:(f4)  .  In fact, I like it less.

-Dan

PS: I had an error in my previous msg. I wrote:

>  I'm thinking more along the lines of things which 
>  weren't in the language, but are used so much in 
>  extant code that we can't reverse the decision.

I meant "I'm thinking more along the lines of things which WE WISH weren't in 
the language....".

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to