Pascal, the definitions were provided, after the countdown, in my first post. However, as I mentioned in that post these are hints/solutions because I was using a version of J with extensions described in [1] (referred in the same post) and it is not yet widely available but we are planning to release the patches and a new 32-bit Windows version probably this week. I also gave some hints in that post on how to write them using an official version but it is not straightforward exercise.
On Tue, Mar 4, 2014 at 7:50 AM, Pascal Jasmin <godspiral2...@yahoo.ca>wrote: > thank you Dan and Pepe, > > I've been unable to track down the definitions used below. Though I think > I remember seeing them recently... just not recently enough. > > > ________________________________ > From: Dan Bron <j...@bron.us> > To: programm...@jsoftware.com > Sent: Monday, March 3, 2014 8:56:50 PM > Subject: Re: [Jprogramming] Tacit recursion without $: > > > Pepe wrote: > > The problem is, as you now know, exceeding the 100 KB limit. So I > > followed Chris' advice and trimmed the old messages. > > > > These are the answers to your questions, > > Below is the message Pepe is responding to, for context (and so that it > shows up in the Forum archives, which I rely on). > > Pepe wrote (earlier): > > Dan, in the meantime you might find the following somewhat enticing, > > > > u0`u1`u2`u3 At=. (at~&:train)/ o |. f.adv > > u0@:u1@:u2@:u3 > > > > or even better (removing the middle man), > > > > eval=. train o ({: ; (an o }:)) NB. Verb form > > ... > > [: u0 u1 u2 u3 At > > u0@:u1@:u2@:u3 > > Awesome! I've wanted something like this (no-middle-man) since 2010 [1], > and the J community has been wanting (train-to-pipeline) since at least > 2003 [2]. I'm very glad to have these tools and they're going straight in > my toolbox. Thank you. > > I think the only last thing we need is some nicer notation for the pattern. > In [2], Paul Chapman proposed defining (: ): for this purpose, and that > idea has been raised a few times since (mostly by me :). But, rather than > change the DoJ so drastically, with the advent of Unicode we should be > able to provide, in userspace, our own custom symbols to denote a verb > pipeline (perhaps guillemets e.g., <<u1 u2 u3 u4>> as I suggested in [1], > but really, anything from [4] could work). Of course, that would require > us to add support for Unicode identifiers in the language, so I'm glad to > see active discussion of that idea in recent threads (it would be more > satisfying and less risky to change the language to support Unicode than > introduce new punctuation like (:): or (.). etc.) > > [These are the questions Pepe was responding to, below] > > I haven't had a chance to try out your examples below yet, but did you > manage to work around the rightmost-hook limitations that have plagued all > tools in this vein to date [3]? What does your utility produce for (u1 u2 > (u3 u4)) ? > > Does it preserve the embedded hook at the right edge, or glue its > components together with the top-level verbs? Is that consistent with its > treatment of other nested trains (e.g. a hook embedded somewhere off the > right edge, or nested forks, etc)? What does it do with doubly-nested > trains, and deeper? > > If it doesn't produce u1@:u2@:(u3 u4) for u1 u2 (u3 u4), I have a vague > sense that this problem arose in another context quite recently, and > someone posted a solution. Maybe Raul and/ or Pascal? > > -Dan > > [1] Adverb for creating verb pipelines from trains, > which I couldn't get working the way I wanted: > > http://www.jsoftware.com/pipermail/programming/2010-June/019756.html > > [2] Paul Chapman on using '):' to enclose trains and glue the component > verbs together using @:, in order to reduce visual noise in J > expressions (because pipelines are a common pattern and having lots > of @: clutters them up & buries the logic): > > http://www.jsoftware.com/pipermail/general/2003-August/015037.html > > [3] Paul's script to produce pipelines from trains: > http://www.jsoftware.com/pipermail/general/2003-August/015037.html > > [4] Various ways of denoting quotation, e.g.?u1 u2 u3 u4: > > http://en.m.wikipedia.org/wiki/International_variation_in_quotation_marks > > [Chronologically, the message below appeared before this one, but > sequentially it comes after] > > ----- Original Message --------------- > > > Subject: Re: [Jprogramming] Tacit recursion without $: > From: Jose Mario Quintana <jose.mario.quint...@gmail.com> > Date: Mon, 3 Mar 2014 12:13:35 -0500 > To: Programming forum <programm...@jsoftware.com> > > Dan, > > The problem is, as you now know, exceeding the 100 KB limit. So I > followed Chris' advice and trimmed the old messages. > > These are the answers to your questions, > > [: u0 u1 At > u0@:u1 > > I should point out that neither there is a train nor a need for > parentheses. There is an issue when there is a single verb in the strand > (because a verb associated to / is not executed when the argument is a > single item), > > [: u0 At > +--+ > |u0| > +--+ > > It can be fixed as follows but I might not be worth it, > At=. (train ^: (L.~: 0:)) o ((at~&:train)/) o |. f. sv > [: u0 At > |value error: u0 > [: * At > * > It also produces an error for an empty strand but this behavior seems right > to me, > [: At > |domain error: At > | @:a: > > Regarding (u1 (u2 u3)) , (u1 u2 (u3 u4)), > > > [: u1 (u2 u3) At > u1@:(u2 u3) > > [: u1 u2 (u3 u4) At > u1@:u2@:(u3 u4) > > ---------------------------------------------------------------------- > 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