".@'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

Reply via email to