> -----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 )
> >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 kind of
> return address on a stack. Of course, such an implementation of tail
> recursion is desirable, but it is iteration, in fact.
> 
> I just wanted to point out that recursion generally is not a 
> benefit at
> all. 

The benefit of recursion is economy of expression.  In some cases
a recursive solution is clearer and more maintainable than it's 
iterative equivalent.

Econonomy of expression, along with portability, is the primary reason we
use high level programming languages.

>       It is also no special sign of functional programming 
> languages, you
> can do recursion in most imperative languages as well.

Recursion is associated with functional programming in that one
typically implements iterative constructs with recursion in
functional programming languages.  Many functional programming
languages allow for iteration without recursion, but recursion
is the typical way of implementing iterative algorithms in
functional programming languages.

While you can perform recursion in most imperative languages, 
you would only resort to recursion in cases where it's clearly
the obvious clean solution.  In functional languages, you use
recursion more often.  

Many functional programming languages have no iterative
construct except recursion.  It would be difficult to program in
an imperative language with recursion as your only interative
construct, it's usually unnatural in functional languages to 
use anything but recursion for this.  Thus, recursion and functional
programming are often associated together.

>                                                          The 
> good thing about
> functional programming languages is merely the fact that symbols are
> evaluated regardless wether they're bound to data or to a 
> function. This
> allows high level of data and functional abstraction without having to
> extend the core language.
> 
> BTW, with trow and catch it should theoretically be possible 
> to implement
> multitasking. Does anybody know how the "evaluation loop" at 
> top level of
> REBOL works? (not that I want to implement multitasking, 
> that's far beyond
> my capabilities, I'm just curious...)
> 
> Greetings,
> 
> Erich
> 
> 
> 

-Jordan Henderson
[EMAIL PROTECTED]

Reply via email to