Talk:Essays/Tacit Expressions

From J Wiki
Jump to: navigation, search

  • Monadic hook (f g) y is a generalization of reflexive. In fact, (f ]) y ≡ f~ y . In general, hook reflects its argument with a modified self on the right. For example, (>. -) is magnitude, (% >./) is scaling. -- Oleg Kobchenko 2006-05-22
  • This page is meant to focus on the reflexive. It is true that hook is a generalization of reflexive, but why stop there? Fork is a generalization of hook, and the monad f~ is just the monad of the fork ] f ] . -- Roger Hui <<DateTime(2006-05-22T16:33:19Z)>>
  • Discussing a subject, it is good to mention related areas. There is an immediate analogy: y f y and y f g y . And the idea about fork is good too: (h y) f (g y). The common benefit of these facilities is reusing the argument without explicit indication, thus extending the possibilities for tacit expressions. -- Oleg Kobchenko <<DateTime(2006-05-22T17:39:52Z)>>
    • In this case, by mentioning too many things you lose focus and can lead the reader astray. See following item. -- Roger Hui <<DateTime(2006-05-22T19:43:37Z)>>
    • ... or the writer, yes. I suggest moving the proceedings of this discussion into a new topic, such as "Tacitization", then link from here. It would describe the role of each feature (reflexive, passive, hook, fork, atop, etc.) with patterns (use cases) and examples, etc. -- Oleg Kobchenko <<DateTime(2006-05-22T20:48:42Z)>>
  • Perhaps we should mention the contexts where a person learning, reading, or maintaining J code is likely to encounter ~. I find it is usually applied as a stylistic measure. Apropos of the preceding comments, it is usually in association with either hook or fork:
    • One of the most common and useful applications of ~ is within a hook. Two examples:

1.#0 Monadic filtering: #~ f where f is the filter, e.g. #~ 0 < ] NB. Select positive numbers 2. Classification of data: g/.~ f where f is the classification function and g processes classes, e.g. </.~ * NB. Group by sign

    • Another common use of ~ is in forks. To increase readability, ~ is used to shorten or simplify long trains. That is: a complex, parenthesized right tine (usually a train itself) is often swapped with a simpler left tine, with the middle tine commuted, so that the parens around the tine can be removed. Example:

1.#0 (+/ % #) % <./ becomes <./ %~ +/ % #.

This transformation is usually applied both iteratively and recursively, resulting in a flattened (minimally parenthesized), but equivalent train. I call this transformation flattening, front-loading, or right-loading. -- Dan Bron <<DateTime(2006-05-22T18:08:14Z)>>

  • The use of ~ in the preceding point is irrelevant, as in both cases it is the dyad f~ (passive or commute) that is used. -- Roger Hui <<DateTime(2006-05-22T19:43:37Z)>>
  • I was aware, when I wrote them, that my comments made no use of "reflexive". Notice that I don't use that word, but I do use the word "commuted" (and "swapped"). Most references are to the symbol ~ (hence "... is likely to encounter ~") . I wasn't led astray so much as I was continuing a train of thought (hence "Apropos of the preceding comments ... "). Oleg has given a useful name to the ideas I was trying to express.

    I think such a essay would be more useful and interesting than one dedicated only to "reflexive", as dyadic invocations of f~ are much more common, widespread, and useful than monadic invocations. Of the examples given, I, personally, have only ever used 2. Of the remainder, half are reproductions of primitives.
    -- Dan Bron <<DateTime(2006-05-22T21:19:04Z)>>
  • Well then you should write that other essay, rather than try to cram unrelated ideas into an essay on reflexive. -- Roger Hui <<DateTime(2006-05-22T21:28:07Z)>>

From Essays/Reflexive

  • The discussion will continue here. The material of the discussion will be gradually adapted for the body of this topic. -- Oleg Kobchenko <<DateTime(2006-05-22T23:22:51Z)>>
  • I had only the idea to help users read code. I did not have the idea to split it onto a seperate essay. The credit there belongs to Oleg. I considered my comments incentives to rename and repurpose your essay. Moot now; we have the skeleton of the new essay. -- Dan Bron <<DateTime(2006-05-23T00:28:36Z)>>
  • I'm focusing on the interpretation hierachy essay, so I probably won't contribute large passages to this. But I'll contribute ideas or seeds, if that's helpful. -- Dan Bron <<DateTime(2006-05-23T00:28:36Z)>>