I was thinking of `. as a modifier for / /\. and a few other adverb sequences, to provide the initial value (which matters when it would be a different shape, or type, from the sequences being operated on.
Taking this the next step, let's maybe use O: to introduce v - O: would be similar to @: but would be for use in folds. v O:u/\.`. would be my alternate syntax proposal for u F::v I'm not sure, yet, that this is better, but I'd like to at least talk through the issues. Well, ok, it *is* better in the sense that my proposal introduces less new vocabulary, and takes advantage of visual similarity in a way that the F. F.. F.: F: F:. F:: proposal does not. But the specific details might be too gimmicky - for example, it might be better to instead have a `. and a `.: for example, where the `. is an adverb and the `.: is a conjunction (whose right argument is v). Thoughts? Thanks, -- Raul On Sun, Mar 4, 2018 at 12:38 PM, Henry Rich <henryhr...@gmail.com> wrote: > OK, now we are getting somewhere. I am moving this back to Programming > (because I don't follow Chat). To your points: > > 1. Often unnecessary: agreed. Fold will not replace u/ etc.: > a. it's too wordy > b. The many ingenious optimizations in u/ will not be provided, at least > not initially > > 2. If v is an identity, who would need Fold? > a. often true, and they wouldn't use it then > b. but using Z: to control iteration may be convenient > c. Fold allows iteration front-to-back, avoiding &.|. > d. Fold allows specifying an initial value for the first application of u > > My expected application for Fold is when u is NOT a primitive. It might be > tacit or explicit, but u is going to be called for each item of y. Fold > gives a terse way to express its computation: the question is whether those > computations are common enough to justify the work. I agree with Marshall > that they are. > > I am open to your second-conjunction idea, though I don't see how it would > work. I considered making Fold a set of adverbs using a gerund u before > settling on the proposal as written. > > I have expanded the proposal to allow v to be a noun n, which would execute > n&{:: . > > Henry Rich > > > > On 3/4/2018 11:56 AM, Raul Miller wrote: >> >> I see where you are going with this now. >> >> And, I do like the thinking. (I'd have to think a bit more, though, to >> come up with good examples, for documentation purposes.) >> >> That said, this seems like it would be unnecessary in a good number of >> cases - only the "scan-like folds" really make good use of it, and >> then only when v is not an identity function. >> >> Perhaps, instead, if we can dip into symbolism a bit more, we could >> introduce a second conjunction that modifies folds at the "generate >> intermediate result" stage? >> >> [Does this description make sense?] >> >> Thanks, >> > > > --- > This email has been checked for viruses by AVG. > http://www.avg.com > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm