You seem to be getting some traction on fold. Would be nice to see something happen. Some consensus would be a compelling reason to move on it.
On Fri, Mar 2, 2018 at 9:32 AM, Henry Rich <henryhr...@gmail.com> wrote: > From my own use, I use the Forward versions more than the Reverse, by a > large margin, and I don't want to force the user to use |. needlessly. > > Henry Rich > > > On 3/2/2018 9:12 AM, 'Pascal Jasmin' via Programming wrote: > >> Very useful overall, but may I suggest 4 F. family versions (ommitting >> the forward version). This improves editability among variations, IMO, and >> makes the operator codes easier to remember. >> With the above change, F. and F.. mnemonics should be swapped. The >> "monad first execution" has fewer applications than "initial value for >> reduce". >> >> From: Henry Rich <henryhr...@gmail.com> >> To: programm...@jsoftware.com >> Sent: Friday, March 2, 2018 5:11 AM >> Subject: Re: [Jprogramming] Insert initialising >> Marshall, please criticize the proposal at >> >> http://code.jsoftware.com/wiki/System/Interpreter/Requests# >> Fold_.28strawman.29 >> >> Others' criticism welcome too. >> >> Henry Rich >> >> On 3/2/2018 3:38 AM, Marshall Lochbaum wrote: >> >>> There's no clean way to do it. If the result of the first invocation of >>> f has the same type as the rest of the list elements, you can do >>> >>> f/ _2 (}. , f0/@:{.) l >>> >>> and if it has a different type you can check whether the right argument >>> has this type (like your "signature structure", but implicit). >>> >>> One of my most missed features in J is a reduce with a specified initial >>> element. Thus (l f/ e) would be equivalent to (> f&.>/ (<"_1 l),<e) but >>> without the very large inefficiency of boxing everything. Of course >>> dyadic f/ is already taken, so it would need another symbol. With this >>> feature, you could use (_2 (}. f/ f0/@:{.) l) regardless of the >>> properties of f. >>> >>> If your initialization comes before any of the processing and doesn't >>> change the arguments (so that the first function invocation f0 is >>> equivalent to (f[i0) for some initializer i0), then you can use >>> (f/ l [ i0/ _2{.l), that is, separate the initialization from the >>> function application completely. >>> >>> Marshall >>> >>> On Fri, Mar 02, 2018 at 01:51:39PM +0530, Arnab Chakraborty wrote: >>> >>>> Hi, >>>> >>>> If f is a dyad, then >>>> >>>> f/ 2 4 5 >>>> >>>> means >>>> >>>> 2 f 4 f 5 >>>> >>>> where the rightmost occurence of f is invoked first. I am wondering if >>>> there is a smart way to recognize this first invocation separately from >>>> the >>>> rest. This will enable me to perform some initialization inside f. By >>>> "smart" I mean something smarter than the followung two: >>>> >>>> 1) using side effect like setting a global flag. >>>> 2) adding some signature structure to the output of f (eg, 'inited'; >>>> result), >>>> and then checking the absence of this signature. >>>> >>>> Thanks. >>>> ---------------------------------------------------------------------- >>>> For information about J forums see http://www.jsoftware.com/forums.htm >>>> >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >>> >> >> --- >> 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 >> >> ------------------------------------------------------------ >> ---------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm