On Sat, 15 Nov 2008, List wrote:
> the specific example I gave, (1: + 2: * i.)5 seeing that the
> expression in the parenthesis is a verb train which should be
> interpreted as a fork (particularly after understanding that 1: and 2:
> are verbs) suddenly made the result clear. What you do with five verbs
> in a row is a little tricky at first, but falls into place once you see
> how verbs work when strung together. What was not clear was that the
> statement odds =: 1: + 2: * i. needed to be parsed and interpreted
> independently before any analysis of arguments (none, one or two, and of
J is an interpreter, each sentence is executed in a strict order.
eg. when execute the following sentence,
(1 + 2) * 3
(1 + 2) is parsed and evaluated to a number 3 and continue to evaluate
3 * 3 which gives 9.
For another expression
(+/ % #) 3 4 5
it does not evaluated to
(+/ 3 4 5) % # 3 4 5
but instead, an anonymous verb is created by evaluating (+/ % #) and
continue to evaluate as
anonymousverb 3 4 5
after the whole sentence is evaluated, the definition and storage of
the anonymous verb is purged. Or you can assign a name to the verb
so that it survives after evaluation.
(mean=: +/ % #) 3 4 5
or break it into 2 sentences
mean=: +/ % #
mean 3 4 5
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩136 劉長卿 尋南溪常山道人隱居
一路經行處 莓苔見履痕 白雲依靜渚 春草閉閑門
過雨看松色 隨山到水源 溪花與禪意 相對亦忘言
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm