Skip, I am at this moment reading through Henry's chapters on tacit programming in J for C programmers as a bit of a tune up. He really covers that material well and goes into depth about why you can't just assume parenthesis around all named entities. It is not light reading, but is worth the effort. Parsing and execution parts 1 and 2 are a few chapters in to the tacit programming section.
http://www.jsoftware.com/help/jforc/tacit_programs.htm#_Toc191734582 Cheers, bob > On Jul 7, 2018, at 3:06 PM, Skip Cave <[email protected]> wrote: > > Hmmm.. parentheses are automatically added when I assign a name to a verb! > What is the rationale for always adding parentheses when assinging a name > to a verb? It seems to be unnecessarily complicating a simple process. > > In any case, what method can I use to remove those parentheses, or at least > nullify their effect, when assiging a name? > > Skip > > > > On Sat, Jul 7, 2018 at 4:12 PM Henry Rich <[email protected]> wrote: > >> Assigning to a name adds an implied set of parentheses. Thus if you write >> >> f =. +/!>:2*i. >> >> When you execute >> >> f 5 >> >> you will get the same result as if you had executed >> >> (+/!>:2*i.) 5 >> >> Try it and see. >> >> Henry Rich >> >> >> On 7/7/2018 5:07 PM, Skip Cave wrote: >>> I have a tacit verb that finds the sum of the factorials of the odd >>> integers from 1 to 2n - 1: >>> >>> +/!>:2*i.1 >>> >>> 1 >>> >>> +/!>:2*i.2 >>> >>> 7 >>> >>> +/!>:2*i.3 >>> >>> 127 >>> >>> +/!>:2*i.4 >>> >>> 5167 >>> >>> I want to assign that tacit verb a name f: >>> >>> f=. +/!>:2*i >>> >>> f 1 >>> >>> 2 >>> >>> f 2 >>> >>> 3 3 >>> >>> f 3 >>> >>> 4 4 4 >>> >>> f 4 >>> >>> 5 5 5 5 >>> >>> >>> My tacit verb doesn't work the same when I assign it a name. How do I >>> modify the verb to allow me to name it? Why do I have to change my verb, >>> just because I assign it a name? >>> >>> Skip >>> >>> >>> Skip Cave >>> Cave Consulting LLC >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >> >> >> --- >> This email has been checked for viruses by AVG. >> https://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
