Yeah... english overloads word meanings (mostly resolved by context, but we fall into habits and expect others to share those habits).
Anyways, here, [x] could have been a J phrase, but here it was borrowing from syntax diagram summary spellings (where brackets traditionally indicate an optional element). So... it only looks stupid. You tripped over a glaring ambiguity (and I went over things too fast and didn't adequately realize the nature of the issue). Thanks, -- Raul On Fri, Aug 24, 2018 at 12:01 PM 'Jim Russell' via Programming <[email protected]> wrote: > > Re trying my own examples— > I’m not too proud to flaunt my ignorance: > > foo=:[x] ".@'name' y > |domain error > | foo=:[x] ".@'name'y > > I long ago choose (probably foolishly) to not spend a lot of time trying to > understand tacit J. My rationale was that I would be unlikely to recover the > cycles lost to the idle loop while I was studying to improve my j code. You > know the old wisdom: > Q: When should you optimize your code? > A: Not yet. > > Yet, now that I have been retired for a few years, I have the curiosity to > try again. Thanks to JforC, I am learning that [ and ] appear often in tacit > expressions, but x not so much. I expect that with a few more readings of > Forks, Hooks, and Compound Adverbs I’ll see how dumb my confusion was. > > Your examples should help; thanks Raul! > > > On Aug 24, 2018, at 10:18 AM, Raul Miller <[email protected]> wrote: > > > > Sort of? > > > > It's an optional left argument that would be part of the larger J > > expression if it was present? > > > > (That phrase was intended to show how it's used...) > > > > Stil, we should have more havbits of trying things out. > > > > With that in mind: > > > > example=: p:i.3 > > 9 */@(".@'example') 8 > > 30 > > */@(".@'example') 8 > > 30 > > */@(".@'example') > > */@(".@example) > > > > It's better though, when you try your own examples. > > > > Thanks, > > > > -- > > Raul > > > > On Fri, Aug 24, 2018 at 9:27 AM 'Jim Russell' via Programming > > <[email protected]> wrote: > >> > >> Is it safe to understand that “[x]” indicates an optional left argument, > >> and is not part of a the J expression? > >> > >>> On Aug 24, 2018, at 9:19 AM, Raul Miller <[email protected]> wrote: > >>> > >>> Also, in this example, ‘name’ was meant to represent a pronoun. > >>> > >>> Thanks, > >>> > >>> — > >>> Raul > >>> > >>>> On Friday, August 24, 2018, Henry Rich <[email protected]> wrote: > >>>> > >>>> ".@'name' is a verb. In > >>>> > >>>> [x] ".@'name' y > >>>> > >>>> y (and x if given) are ignored, and the result is the value of (name) > >>>> when > >>>> the verb is executed. > >>>> > >>>> This is the same as it used to be, but is now faster. > >>>> > >>>> Henry Rich > >>>> > >>>>> On 8/23/2018 10:22 PM, Brian Schott wrote: > >>>>> > >>>>> Henry, I'm still a little lost. > >>>>> Is the final `npixels` a (monadic, in this case) verb which will take a > >>>>> noun argument, > >>>>> or is the current value of windowsize that noun. > >>>>> > >>>>> If the latter, and windowsize is that noun, then what is the value of y > >>>>> in > >>>>> the original expression `[x] ".@'name' y`? > >>>>> > >>>>> If the former (`npixels` is a verb -- and this is the one I'm leaning > >>>>> toward), then what is the y value that is its argument? > >>>>> > >>>>> TIA. > >>>>> > >>>>> On Thu, Aug 23, 2018 at 9:41 PM, Henry Rich <[email protected]> > >>>>> wrote: > >>>>> > >>>>> Often you need for a verb to refer to the value of a name when the noun > >>>>> is > >>>>>> executed, rather than when it is defined. So, rather than > >>>>>> > >>>>>> npixels =: */ windowsize > >>>>>> > >>>>>> which would just be a noun, you write > >>>>>> > >>>>>> npixels =: 3 : '*/ windowsize' > >>>>>> > >>>>>> to defer taking the value of (windowsize) until (npixels) is executed. > >>>>>> > >>>>>> In tacit code, you used to write > >>>>>> > >>>>>> npixels =: */ @: ". @ ('windowsize'"_) > >>>>>> > >>>>>> to get the same result. Recently the syntax was added to allow > >>>>>> > >>>>>> npixels =: */ @: ". @ 'windowsize' > >>>>>> > >>>>>> All that still works. But the (".) verb starts the parser and executes > >>>>>> its y argument as a sentence, with a modest overhead that will matter > >>>>>> if > >>>>>> the verbs have small ranks. Now, you can write > >>>>>> > >>>>>> npixels =: */ @: (". @ 'windowsize') > >>>>>> > >>>>>> [parentheses important! make sure you see why]. When (npixels) is > >>>>>> defined, this form will detect that the argument to (".) is a single > >>>>>> name. > >>>>>> When (npixels) is executed, the name will be evaluated without going > >>>>>> through the overhead of starting a sentence. > >>>>>> > >>>>>> Henry Rich > >>>>>> > >>>>>> ---------------------------------------------------------------------- > >>>>> 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 > > ---------------------------------------------------------------------- > > 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
