get syntax error
________________________________ From: Jose Mario Quintana <[email protected]> To: "[email protected]" <[email protected]> Sent: Wednesday, March 22, 2017 11:44 PM Subject: Re: [Jprogramming] introducing j plus plus Thanks for the feedback Pascal. I just realized that I might have used tacit anonymous continuations inadverterdly when I wrote, in Jx, the tacit recurrent (aka multiple) adverbs sa and sna which can convert adverbs taking arguments as a gerund into adverbs taking arguments as a strand [0]. Incidentally, I have rewriten similar versions of adverbs which run in official J interpreters but that should be a subject for another thread in another time. In the meantime the following is a little puzzle in the same vain: WhoAmI '' 'I am presenting myself by executing this sentence :)' '' 'Spoiler coming in,' '' (,.|.i.33) '' (|.'...brev gnicudorper-fles eht ma I') '' I am presenting myself by executing this sentence :) Spoiler coming in, 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 I am the self-reproducing verb... (<([ ,^:(0:`&) >)@:[ [ 0 0&$@(1!:2&2)@:])&(([ ,^:(0:`&) >)@:[ [ 0 0&$@(1!:2&2)@:]) [0] [Jprogramming] Tacit recursion without $: * http://www.jsoftware.com/pipermail/programming/2014-February/035416.html <http://www.jsoftware.com/pipermail/programming/2014-February/035416.html>* On Wednesday, March 22, 2017, 'Pascal Jasmin' via Programming < [email protected]> wrote: > The f11 script for running a multiline definition from anywhere inside the > enclosing code is also pretty cool > > 0. for (0 {:: ]) 1. for (1 {:: ]) is a big convenience to me too. 0.~ is > (0 {:: [) > > but quoteless code is the big feature. It makes it much easier to use > custom parsers. Gerunds specifically are easier to input with a higher > priority than conjunction separator (Q uses ; the way gg uses ` as > separator) > > It should be compatible with existing code as well. The one caveat is > that "fancy" multiline code (hides a (: 0) ) should use the magic constant > ML so the parser can know it is multiline. or modify the nummultiline verb. > > it already handles code lines such as > > > 3 : 0 : (4 : 0) NB. 2 multiline closing ) are needed. > > > > As to question on continuations, it is based closely on > > > http://code.jsoftware.com/wiki/Guides/Lexical_Closure > > but with the option of being fully anonymous. Still currently a toy. > > One neat feature in the toy unrelated to closures/continuations is SNR - > self name reference. This allows genericity in having a function return a > function of itself. > > > A function "should"/may return a new function and a result. The best > example in the toy is > > mycycle > ┌───────────────────────────────────┬──┐ > │┌───────────────┬───────────┬─────┐│11│ > ││┌─┬───────────┐│cycle_base_│┌─┬─┐││ │ > │││0│10 11 12 13││ ││0│2│││ │ > ││└─┴───────────┘│ │└─┴─┘││ │ > │└───────────────┴───────────┴─────┘│ │ > └───────────────────────────────────┴──┘ > > > This contains 2 items. A gerund representing a function, and the last > result > > cont2 'mycycle' > 12 > cont2 'mycycle' > 13 > > these return the function result but also updates the function > > > mycycle > > ┌───────────────────────────────────┬──┐ > │┌───────────────┬───────────┬─────┐│13│ > ││┌─┬───────────┐│cycle_base_│┌─┬─┐││ │ > │││0│10 11 12 13││ ││0│0│││ │ > ││└─┴───────────┘│ │└─┴─┘││ │ > │└───────────────┴───────────┴─────┘│ │ > └───────────────────────────────────┴──┘ > > cycle_base_ is a dyad returns a gerund, and result, but the gerund in > mycycle has both parameters bound to it. > > cycle SNR4.: (x FNAME aar tiD ((#x) | >: y) tiD ) ,&< (y{x) > > the .: glyph quotes both left and right params (until any terminating ")" > or end if none found) > SNR expands the definition to > > cycle > 4 : 0 > FNAME =. 'cycle_base_' > ( x FNAME aar tiD ( ( # x ) | >: y ) tiD ) , & < ( y { x ) > ) > > It rotates through x items. > > > Real applications include lazy data structures. Functions that feed one > data item at a time can work identically with a file or slow-result socket > connection, or terminate after the right result found. Anonymous and > classless versions of this process means there's nothing to cleanup when > you stop querying the next value(s). > > > ________________________________ > From: Jose Mario Quintana <[email protected] <javascript:;>> > To: Programming forum <[email protected] <javascript:;>> > Sent: Wednesday, March 22, 2017 4:16 PM > Subject: Re: [Jprogramming] introducing j plus plus > > > > A quoteless J? That is neat, I do not like quoting code particularly when > it leads to quotes within quotes within quotes within... > > I find the related continuations.ijs script intriguing. Can you explain > what is the purpose of the continuations? How can you use them? Simple > examples would be appreciated. > > > On Fri, Mar 17, 2017 at 9:25 PM, 'Pascal Jasmin' via Programming < > [email protected] <javascript:;>> wrote: > > > A preparser for J that autocloses parentheses, and makes embedding quotes > > easier. Also has user-defined primitives. > > > > > > https://github.com/Pascal-J/jpp > > > > as examples, > > > > 4 timespacex: +/ i.1000 > > > > is equivalent to > > > > 4 timespacex '+/ i.1000' > > > > the suggested F11 macro is pretty neat. Runs a section of code in a > > file. Unlike ctrl-R, you don't need to be at the top level line in order > > to run the multiline group that encloses the current line. > > ---------------------------------------------------------------------- > > 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
