My understanding was that tail recursion ( or its optimized implementation )
gives a (properly written) recursive program the efficiency of an
iterative program.
Yes, because such implementations avoid "real" recursion, i.e. when they
encounter tail recursive function calls they do not push some
Well ... I have been waiting for a reply to the message below. Has there
been a reply and I missed it? I have been trying to use rebol for CGI
scripts which is the main reason why I started to use it. People have send
CGI examples to me, which work for them but they don't work for me. I have
by
Erich,
I timed three methods of filling a block with successive integers from `
1 to 1000. The times are for 1000 iterations. It would seem that head
recursion is rather slow.
Jerry,
time-block/reps [a: array 0 for i 1 1000 1 [insert tail a i]] 1000
0:00:11
time-block/reps [a: array 0 for
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 27, 1999 5:57 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] Encouraging functional programming Re:(4)
My understanding was that tail recursion ( or its optimized
implementation )
You wrote:
I am considering writing an app that would create several hundred or
a few thousand copies of a single object. One way to keep track of them
is to use an array. A script that tests this syntax is below along with
a run which does a "print mold" on the array. It appears that the
Jordan,
I calculate the Fibonnacci numbers without recursion using REBOL. For
example
fib 100
== 3.54224848179262E+20
How would you calculate it with recursion?
Jerry
Does anyone have a simple listen script? I want to see what my web
browser is sending to the web server.
I tried the various examples I've seen, and followed the howtos on
rebol.com, but can't get it to function.
Thanks,
---
Regards,Graham Chiu
gchiuatcompkarori.co.nz
Elan wrote:
Hope this helps,...
Thanks, Elan. I've been comparing my REBOL code too closely to my C++
code and forgetting that REBOL words are far more "smarter" than C++
variables. The closest relative in C++ is smart pointers.
Andrew Martin
[EMAIL PROTECTED]
Graham Chiu wrote:
Does anyone have a simple listen script? I want to see what my web
browser is sending to the web server.
I'm sure there's some useful scripts at:
http://www.rebol.org
Try the proxy. That might serve your puposes.
Andrew Martin
[EMAIL
You might want to try Sterling's proxy (avail. on rebol.org) with a small modification
to save to a file all data passed through. I'd imagine that this shouldn't be
difficult, although I haven't looked at the code recently. Good luck!
--
Andrew Grossman
[EMAIL PROTECTED] wrote:
Jordan,
I calculate the Fibonnacci numbers without recursion using REBOL. For
example
fib 100
== 3.54224848179262E+20
How would you calculate it with recursion?
Jerry
fib: func [first second n] [
either n = 1 [first] [
either n = 2 [second] [
Brent,
I'm confused. You seem to say that
test: func [n /local sum] [sum: 0 for i 1 n 1 [sum: sum + i]]
is not functional since it contains an index. On the other you seem to say
it is functional in that the output depends only on the input without any
side effects.
Where did I go wrong?
I tried this in the script/run included here. It doesn't seem
to work when the functions are methods in an object -
or else the syntax is a little more complex. I've tried
a couple of variations of the syntax, but still get
error msgs rather than an answere one way or the
other.
Lasislav
o!: make object! [
[s: "OneTwoThree"
[St: func [] [s]
[]
o1: make o! [
[o1: "O1"
[]
o2: make o! [
[o2: "O2"
[]
probe o2
make object! [
s: "OneTwoThree"
St: func [][s]
o2: "O2"
]
o2/St: "Hello"
== "Hello"
probe o2
make object! [
s: "OneTwoThree"
St:
Hello John
On 27-Nov-99, you wrote:
If I've comprehended that correctly, a good language should
eliminate tail
recursion and replace it by iteration. This is a feature of most
CommonLISP systems and Scheme.
Well, that would probably require some static analysis of the
REBOL program,
Jordan,
I am impressed with your clever function. It seems to take only 10% more
time than my non-recursive version.
Jerry
From: [EMAIL PROTECTED]
You could use my cookie-client script that is somewhere on rebol.org. It
allows you to read access webpages while sending them cookies.
I'm planning when I have a few minutes free on revising it to work a bit
more nicely and automatically remember cookies and the like.
In article [EMAIL PROTECTED], [EMAIL PROTECTED]
DU writes
You might want to try Sterling's proxy (avail. on rebol.org) with a small
modification to save to a file all data passed through. I'd imagine that this
shouldn't be difficult, although I haven't looked at the code recently. Good
luck!
for those interested, I've updated the Amiga pipebridge and GUI for it,
so it works with rebol v2.2.0.1.1
the new version is at http://www.mindspring.com/~timrue/pbgui2.0.lha
If it's not there when you try, then try again later. It'll get there.
(it's done, I just need to update my web site).
The user's guide says with regard to string values
^[words...] executes a block
yet, print "^[print now]" on 2.2.0.3.1
results in
[print now]
rather than executing the block.
---
Regards,Graham Chiu
gchiuatcompkarori.co.nz
http://www.compkarori.com/dynamo - The Homebuilt
Hi Graham,
you're right, it appears that functionality is still missing.
At 08:08 PM 11/28/99 +1200, you wrote:
The user's guide says with regard to string values
^[words...] executes a block
yet, print "^[print now]" on 2.2.0.3.1
results in
[print now]
rather than executing the block.
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] writes
Hi Graham,
you're right, it appears that functionality is still missing.
I'll fire a bug report off to feedback then.
---
Regards,Graham Chiu
gchiuatcompkarori.co.nz
http://www.compkarori.com/dynamo - The Homebuilt Dynamo
22 matches
Mail list logo