j is a multiple instruction single data language and has many many ways
to pass data, including as far as I can tell all combinations of
monadic, dyadic verbs considering single verbs, their obverses where
practical, the trains of even numbers of verbs, and of odd numbers of
verbs with more than two verbs. Trains have infinite rank, that's why
we cannot consider a single verb as a train. The train/rank question
often appears first with table. (Usually) use the train atomically, at
rank 0 .
X train"0/ Y
Assigning a list of verbs to a proverbial name is a most surprising
aspects of j, one which I didn't realize from the documents for a long
long time. Where stated "Substituted as if in parentheses." is an
absolutely huge short sentence. Parentheses completely change (what I
thought I had as) the sentence. If
{: q: 45
5
biggest_prime_factor_wrong =: {: q:
biggest_prime_factor_wrong 45
|domain error: biggest_prime_factor_wrong
| biggest_prime_factor_wrong 45
biggest_prime_factor_wrong is a hook with hook data passing. {: doesn't
have a dyadic definition. Hence the domain error of
({: q:) 45 NB. equivalent to 45 {: q: 45
As far as I can tell, cap in a fork effectively means to use the monadic
definition of the verb immediately to that cap's right.
biggest_prime_factor =: [: {: q:
biggest_prime_factor 45
5
Other choices. Of those that are correct for a purpose the performance
can drastically vary. Use the largest chunks possible to keep j from
devoting resources to checking data types, frames, and item rank.
Conjunctions here bind first, and from left to right form verbs:
{:@q: 45
5
{:@:q: 45
5
{:&q: 45
5
{:&:q: 45
5
I've personally chosen to write verbs tacitly in the interpreter session
with parentheses, using under, at, atop, compose, or appose when I can
so that I can directly create proverbs. Having little faith in the
future ordering of prime factors, I'd use bpf =: ([: >./ q:) ,
emphasizing the train with parentheses.
Stick with j though it may take years, and please pounce on my errors,
David Lambert
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm