Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Implementation Favoritism, a question of Lisp mindsets
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Pascal Costanza  
View profile  
 More options May 3 2003, 9:34 am
Newsgroups: comp.lang.lisp
From: Pascal Costanza <costa...@web.de>
Date: Sat, 03 May 2003 15:34:38 +0200
Local: Sat, May 3 2003 9:34 am
Subject: Re: Implementation Favoritism, a question of Lisp mindsets
In article <030520030610101628%nos...@iam.invalid>,
 Mark Conrad <nos...@iam.invalid> wrote:

> Okay, here is the closure k that I have been talking about:

> (defvar k)

> (let ((x  'big) (y  'daddy))
>     (setq k  #'(lambda () (list x y) )))

> ? (funcall k)
> (BIG DADDY)

> Now, where is that guy who made a statement a few days ago to the
> effect that a closure preserves the bindings, not the values.

> To me they seem to be essentially the same thing.

> Wonder what he meant?

Try the following:

(defvar k)
(defvar setx)
(defvar sety)

(let ((x 'big) (y 'daddy))
  (setq k #'(lambda () (list x y)))
  (setq setx #'(lambda (value) (setq x value)))
  (setq sety #'(lambda (value) (setq y value))))

? (funcall k)
(big daddy)

? (funcall sety 'mummy)
mummy

Try to guess what (funcall k) will print now.

And PLEASE: It's not very constructive that you don't follow the links
people provide to you. See http://www.psg.com/~dlamkins/sl/contents.html, especially lessons 5 and 6.

Do it! Do it now! Take some time to read and understand these things.
There are over 30 chapters in that book. You don't want to post that
much as you do on every single topic, right?

Pascal


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.