Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Functional > Re: the necessi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 31 of 33 Topic 2757 of 2912
Post > Topic >>

Re: the necessity of Lisp's Objects?

by Pascal Bourguignon <pjb@[EMAIL PROTECTED] > Feb 8, 2008 at 10:33 PM

rem642b@[EMAIL PROTECTED]
 (Robert Maas, see http://tinyurl.com/uh3t)
writes:
> [...]
>> tail recursion
>
> This is not as useful as it's hyped up to be. Sure if you write a
> factorial recursively to emulate iteration, a compiler can convert
> it back to the equivalent iterative algorithm to avoid stack
> overflow. Whooptie-doo. True recursion isn't tail recursion in the
> first place so you don't need this case handled specially. For
> example, the right way to compute factorial recursively is:
> 
> (defun prod (m n)
>   (if (< (+ m 1) n)
>       (let ((mid (floor (+ m n) 2)))
>         (* (prod m mid) (prod mid n)))
>       m))
> (defun fact (n) (prod 1 (+ 1 n)))
>
> The whole point of recursion is divide-and-conquer, epecially if
> you have multiple processors which can run in parallel on sub-tasks.
> Always spawing one sub-task to do a trivial case and the other
> sub-task to do all the work except that one trivial case, whereby
> you actually compute the trivial case directly and tail-recurse on
> the all-the-rest, is outright stupid.

Very good!

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

In a World without Walls and Fences, 
who needs Windows and Gates?
 




 33 Posts in Topic:
Re: the necessity of Lisp's Objects?
rem642b@[EMAIL PROTECTED]  2008-02-04 10:37:38 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-06 17:14:18 
Re: the necessity of Lisp's Objects?
"John Thingstad"  2008-02-06 19:42:31 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-07 00:07:54 
Re: the necessity of Lisp's Objects?
rem642b@[EMAIL PROTECTED]  2008-02-09 15:14:09 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-10 10:27:07 
Re: the necessity of Lisp's Objects?
rem642b@[EMAIL PROTECTED]  2008-02-15 23:12:34 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-16 21:02:03 
Re: the necessity of Lisp's Objects?
rem642b@[EMAIL PROTECTED]  2008-02-09 15:21:54 
Re: the necessity of Lisp's Objects?
"John Thingstad"  2008-02-10 01:48:39 
Re: the necessity of Lisp's Objects?
rem642b@[EMAIL PROTECTED]  2008-02-11 23:29:33 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-12 16:37:06 
Re: the necessity of Lisp's Objects?
rem642b@[EMAIL PROTECTED]  2008-02-07 22:25:25 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-08 21:06:41 
Re: the necessity of Lisp's Objects?
rem642b@[EMAIL PROTECTED]  2008-02-09 15:24:21 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-10 10:26:42 
Re: the necessity of Lisp's Objects?
"David Formosa (aka   2008-02-10 11:23:32 
Re: the necessity of Lisp's Objects?
George Neuner <gneuner  2008-02-10 23:54:27 
Re: the necessity of Lisp's Objects?
rpw3@[EMAIL PROTECTED] (  2008-02-11 02:56:22 
Re: the necessity of Lisp's Objects?
George Neuner <gneuner  2008-02-11 20:53:12 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-12 02:17:33 
Re: the necessity of Lisp's Objects?
"John Thingstad"  2008-02-12 04:48:24 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-12 16:35:17 
Re: the necessity of Lisp's Objects?
George Neuner <gneuner  2008-02-12 15:18:23 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-12 20:16:55 
Re: the necessity of Lisp's Objects?
rpw3@[EMAIL PROTECTED] (  2008-02-12 05:34:01 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-11 10:41:47 
Re: the necessity of Lisp's Objects?
Barb Knox <see@[EMAIL   2008-02-11 09:52:26 
Re: the necessity of Lisp's Objects?
rem642b@[EMAIL PROTECTED]  2008-02-15 23:17:07 
Re: the necessity of Lisp's Objects?
Jon Harrop <usenet@[EM  2008-02-16 20:46:11 
Re: the necessity of Lisp's Objects?
Pascal Bourguignon <pj  2008-02-08 22:33:21 
Re: the necessity of Lisp's Objects?
rem642b@[EMAIL PROTECTED]  2008-02-20 15:25:52 
Re: the necessity of Lisp's Objects?
rem642b@[EMAIL PROTECTED]  2008-02-20 17:12:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 17:08:40 CDT 2008.