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 20 of 33 Topic 2757 of 2904
Post > Topic >>

Re: the necessity of Lisp's Objects?

by George Neuner <gneuner2/@[EMAIL PROTECTED] > Feb 11, 2008 at 08:53 PM

On Mon, 11 Feb 2008 02:56:22 -0600, rpw3@[EMAIL PROTECTED]
 (Rob Warnock) wrote:

>George Neuner  <gneuner2/@[EMAIL PROTECTED]
> wrote:
>+---------------
>| "David Formosa (aka ? the Platypus)" <dformosa@[EMAIL PROTECTED]
> wrote:
>| >Jon Harrop <usenet@[EMAIL PROTECTED]
> wrote: 
>| >> Actually, I can't think of any other languages that sup****t
recursive
>| >> anonymous functions anyway: none of Lisp, Scheme, SML, OCaml, F# and
>| >> Haskell do AFAIK.
>| >
>| >You can do anonymous recusion in Lisp and Scheme via letrec.  Any
>| >language where you can implement the Y-combinator you can get
>| >anonymous recursion.
>| 
>| Lisp doesn't have letrec - you use labels instead.  And technically
>| the functions are not anonymous because the forms require you to bind
>| or name them.  A function has to be named or symbol bound to be
>| recursive - else no way to refer to itself.
>+---------------
>
>Well, true, but you can keep the internal name from escaping by
>returning the function value, making it effectively "anonymous":
>
>    > (funcall
>       (labels ((self (x) (if (< x 2) 1 (* x (self (1- x)))))) #'self)
>       5)
>
>    120
>    > 

Yes, I suppose that is anonymous in the way John intended.

It's a little more verbose in Scheme:

 ((lambda (x)
   (let self ((x x)) 
     (if (< x 2) 1 (* x (self (- x 1))))))
  5)
 120

but I think the Scheme makes it a little clearer that there is a named
self referential function in an anonymous wrapper.  

George
--
for email reply remove "/" from address
 




 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 18 20:44:38 CDT 2008.