Virtual nouns are a way to reduce memory usage and copying. They can
also be thought of a a form of lazy evaluation, where the creation of a
noun is broken into two parts: finding the values and copying the values
into a new noun. If the noun is transitory, there may be no need to do
the copy. Example:
+/ , longtable
Without virtual nouns, execution of (,) required making a copy of the
data. With virtual nouns this copy is avoided. (BTW, virtual support
for (x,y) will be in the next beta, not the current one).
J /cognoscenti/ know that
+/@, longtable
gives better performance because there is special code to recognize the
form. With virtual nouns you don't have to remember the special forms
to save the copying, and the benefit applies to many sequences that are
not supported by special code.
Virtual nouns will be created by any verb that deals with shapes rather
than values. This will include
, y and allies ,"n y ,/ y
x $ y
x ($,) y
x { y when x is a set of consecutive integers
x {. y
x }. y
{. y
{: y
}. y
}: y
x u;.0 y where the selection is contiguous
[x] u;.1 _1 2 _2 y
x u\ y
[x] u"n y
Virtual nouns reduce copying. For operands in cache, copying is pretty
darn fast, so not much is saved; but as the problems grow beyond what
fits is cache, copying slows the CPU down to DRAM speed, which is a
substantial loss.
Henry Rich
---
This email has been checked for viruses by AVG.
http://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm