User talk:Cameron Chandoke/Functional Control Flow

From J Wiki
Jump to navigation Jump to search

"False Convergence"

It's worth noting, perhaps that the false convergence of a (^:^:_) while loop is an issue for "non-functional code".

When the body (u) for the loop is a pure function, false convergence cannot happen. Of course, for other mechanisms (like markov processes) it's a very real problem.

Then again, perhaps it would be best to avoid "pure functional notation" when implementing code which is not "purely functional"? --Raul Miller (talk) 07:21, 29 June 2024 (UTC)

Yes, it would be good to make this more explicit (that convergence is only an issue given a non-functional u operand). And you are right to suggest that it’s important to denote or keep in mind which verbs are impure/effectful.
But, I’d hardly say that the programmer needs a different grammar/syntax (like that of J’s control words) to distinguish impure/emergent-outcome vs. pure/fuctional subprograms. Consider the impure verbs ?, echo, 1!:1, Z:, or any user-defined verbs that deal with I/O. Thus, it seems clear that J offers conventional control word syntax primarily for the sake of familiarity, and for convenience to avoid long run-on lines of code, rather than as a design principle centered around distinguishing functions from general subprograms.
A turing award winner might disagree --Raul Miller (talk) 15:27, 6 July 2024 (UTC)
After rereading most of the paper, I’m not yet clear on how Backus’s FFP handles stateful computations (which is an interesting question), but I mean to point out that the J language already missed the boat on notationally isolating all stateful computations, considering the above examples. --Cameron Chandoke (talk) 01:45, 10 July 2024 (UTC)
The paper (and its author) was an influence on Ken Iverson's design of J - but not the only influence.
Generally speaking, I'd describe the design as favoring efficiency and finite principles (skirting or avoiding the Halting Problem) over generalizations of infinities.
As you've probably realized, a bulk of the language is primitive recursive with perhaps grudging support for full recursion (as obtaining solutions or approximations in finite time tends to be useful).
Anyways... the language tends to favor certain approaches over others, and I believe Ken Iverson thought that more than that would be too much of an imposition. --Raul Miller (talk) 19:07, 11 July 2024 (UTC)
I much appreciate the minimalistic simplicity and regularity of the normal J syntax, and I really like that While is a normal verb/function in other functional langs like [Dyalog/NARS2000/April] APL’s, k, Factor, Haskell.

--Cameron Chandoke (talk) 10:02, 6 July 2024 (UTC)