When I enter Fraser's adverb recf into the jconsole
on my Mac I get the following error message. Ironically, the
adverb works fine, though. I have checked this behavior with
Joey Tuttle and he confirms it on his Mac. Does the error
message appear on any other platforms?
recf=: 1 : 0
:
s =. y
r =. ,:y
for_i.
i. # x
do. s =. (i{x) u s
r =. r,s
end.
r
)
|value error: s
| recf=: 1 :0
(B=)
---------- Forwarded message ----------
Date: Fri, 12 May 2006 14:43:16 +1200
From: Fraser Jackson <[EMAIL PROTECTED]>
Reply-To: Programming forum <[email protected]>
To: Programming forum <[email protected]>
Subject: [Jprogramming] 2 f 3 f 4 f m
What is the simplest way of expressing the very commonly needed
form of which the subject line is an example:
a3 f a2 f a1 f m
a list of items a =. a1, a2, a3, ... applied successively with a function f
and a right argument m of a different shape or even of a different type.
This occurs with any sequential updating process.
The intermediate results are often of interest themselves. recf does what
I want, but is there a neater way?
recf=: 1 : 0
:
s =. y
r =. ,:y
for_i.
i. # x
do. s =. (i{x) u s
r =. r,s
end.
r
)
2 4 6 8 10 + recf i. 2 2
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm