redefine u"v ?

This page is the place to discuss the proposal to redefine u"v .

discussion

Does the idea have merit? Do you have more examples of the desire to calculate a rank? Do you use the current definition of u"v extensively? Would this change create a hardship for you? Are there problems I have not mentioned or foreseen?

I've started a u"v thread on the programming forum to generate interest in the idea; but I would prefer discussion and ideas be collected here, on the wiki.

-- DanBron 2006-11-28 17:19:35

  1. I can see two uses for the existing definition: quick, ad-hoc determination of function rank. For example, +"+. Also, this could be useful where v is a user defined name, particularly if some one else has defined it, and it's subject to change (for example, in an explicit adverb or conjunction). Both of these uses would need to use b.0 instead. (The good news here is that b.0 exists). -- Raul Miller 2006-11-28 16:55:10

    1. I guess I don't understand what you mean by "determination of function rank". How does +"+ "determine" the function's rank? The construct doesn't tell you what the rank of + is, it only assigns to the derived verb the rank of + (which is the purpose of the current definition of u"v). Could you clarify a bit?

    2. By "ad-hoc", do you imply that such constructs probably are used in immediate-execution mode and would not persist in scripts?
    3. I agree with you about the user-defined verbs. After all, any primitive verb's rank can be looked up in the Vocabulary. That's why I suggested the "fixer script" replace u"v with u " (v b. 0)

    4. In the interests of full disclosure, I do have one use of the current definition; namely <"> . It's hard to describe why I use this, probably because it is just a knee-jerk reaction to avoid having constants in my code. The alternative I'm avoiding is <"0, which I find distasteful (and less pretty than the symmetric <">). -- DanBron 2006-11-28 17:19:35

    5. If you type +"+ in immediate execution mode, it will display a derived function which has the same rank as + but the rank itself is visible, numerically. I don't see any reason why this should be persisted in a script.
    6. An example where <"> is nicer than <"0 would be the expression <">0. Of course, if your proposal is adopted, this could be approximated with <"0: -- Raul Miller 2006-11-28 17:42:12

  2. That said, I can imagine Roger's reaction: What problem does this solve? Why not simply use an explicit definition for those cases? (In essence, your proposal would drag some of the complexity of explicit definitions into the fundamental representation of non-explicit verbs.)-- Raul Miller 2006-11-28 17:42:12

    1. Tacit code is an end in itself. It is terse, clear, manipuable (subject to contracts, optimizible, invertible), and elegant. My counterargument to your point would be along the lines of "for the same reason we have u^:m (or m}) for gerund m. Why not force those to be in explicit context?" or, more simply, "Why not?".

    2. Having said that, yes, any change to the interpreter (particularly a breaking change) is not free, probably not trivial, and potentially dangerous. Which is why I didn't make this an "official" request.

      So, I need to dig up more examples of where calculating a rank would be useful. I've run across the case a few times in my career, but I didn't keep a record. Do you (Raul) have any examples?

    3. It may be hard to find examples simply because the existing definition didn't reward J programmers for thinking of them; so they didn't.
    4. How is the current definition superior?

      -- DanBron 2006-11-28 18:13:26

    5. I can't think of any good examples where I'd want variable rank and where "_1 would not serve where box/unbox would not better deal with the case.
    6. After thinking about it, I take back what I said about fundamental function representation. For example, the " operator could use explicit definition, behind the scenes, to support this syntax.
    7. I think the current definition is superior because it is simpler.
    8. Here's a bad example of the use of dynamic rank:

{{{example=:3 :0

)

0 1 2

6}}}

-- MartinNeitzel 2006-12-14 19:07:56:

I'd favour to keep the current meaning. I have no substantial arguments but only my gut feelings on this:

  1. I believe that u"v got used so little because comparatively few people write code at the abstract level of adverbs, adnouns, and conjunctions in general. If more people would dare to create new combinators at the simple level of &, we would see more uses of u"v.

  2. I used u"v only two or three times in all the time (>10 years). In these cases it provided what I needed, though. All in all, I think that u"v provides an important tailoring for adverb/conjunction definitions and this exactly at the needed (non-)complexity level. We better keep this simple, I'd say.

  3. The proposal reminds me of the verb} and gerund} Amend cases where I sometimes have to write extra code to defeat all the possible x/y dependencies I don't need.

  4. I am suspicious about adverbs/conjunctions which take not just u,v,m,n into account but which are also "strategically" influenced by the values of x,y. I am scared that this too easily violates some boundaries of abstraction layers one better tries to stick to.

DanBron/Temp/rank redefinition (last edited 2008-12-08 10:45:48 by )