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
special variables
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 26 - 29 of 29 - Collapse all  -  Translate all to Translated (View all originals) < Older 
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
 
Erik Naggum  
View profile  
 More options Sep 9 2002, 5:32 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 09 Sep 2002 21:32:16 +0000
Local: Mon, Sep 9 2002 5:32 pm
Subject: Re: special variables
* Aleksandr Skobelev
| Could you elaborate on this in more details, please?

  I need some motivation to do that.

| I didn't have an intent to get an absolutely correct description of
| variables evaluation mechanism but just a somewhat simplificated model that
| able to lit a some light on the topic for a person that is not a Lisp
| expert.

  This is the opposite of motivation for me.  Some of us here actually spend a
  lot of time trying to get things absolutely correct, only to be met with a
  strong desire to get it less than correct and highly confused.  This is not
  rewarding.

| But, after looking in HyperSpecs and in proposal that has been mentioned by
| Kent Pitman (thank you, Kent, it is very useful), I still don't understand
| what 'is just plain wrong' in my message.

  Then you do not understand what you wrote, either.  

> If symbol isn't declared as a special one, then in LET form Lisp will try to
> find binding in lexical scope first, and then, if failed, in global scope.

  This is not true.  It is horribly confused.

| So, I hope, you will help me to understand in what.

  I no longer know where you went wrong, so I cannot help you.

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.


 
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.
Ingvar Mattsson  
View profile  
 More options Sep 10 2002, 11:15 am
Newsgroups: comp.lang.lisp
From: Ingvar Mattsson <ing...@cathouse.bofh.se>
Date: 10 Sep 2002 16:11:34 +0100
Local: Tues, Sep 10 2002 11:11 am
Subject: Re: special variables

ilias <at_n...@pontos.net> writes:
> Fred Gilham wrote:
> > ilias <at_n...@pontos.net> writes:
> >>is there any difference between *lexical* and *local* ?
> > Yes.
> > A variable can be lexical without being local.  A variable can be
> > local without being lexical.

> of course i've understood nothing.

> for me it looks like its a local variable, with some extensions
> mechanisms (e.g. like 'static' in C).

They're quite different.

Look at these examples:

(let ((behaves-essentially-as-static 0))
  (defun foo ()
    (incf behaves-essentially-as-static)))

(defun make-adder (increment)
  (lambda (val) (+ val increment)))

(defun test-adder ()
  (let ((f1 (make-adder 3))
        (f2 (make-adder 7)))
    (list (apply f1 2) (apply f2 2) (apply f1 5) (apply f2 5))))

Now try first guessing what these two function calls will return:
(list (foo) (foo) (foo))
(test-adder)

//Ingvar
--
Coffee: Nectar of gods / Aesir-mead of sysadmins / Elixir of life


 
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.
Rob Warnock  
View profile  
 More options Sep 10 2002, 7:41 pm
Newsgroups: comp.lang.lisp
From: r...@rpw3.org (Rob Warnock)
Date: Tue, 10 Sep 2002 23:37:32 -0000
Local: Tues, Sep 10 2002 7:37 pm
Subject: Re: special variables
Ingvar Mattsson  <ing...@cathouse.bofh.se> wrote:
+---------------
| (defun test-adder ()
|   (let ((f1 (make-adder 3))
|         (f2 (make-adder 7)))
|     (list (apply f1 2) (apply f2 2) (apply f1 5) (apply f2 5))))
+---------------

Typo? I think you meant one of the following alternatives, yes?

        (defun test-adder ()
          (let ((f1 (make-adder 3))
                (f2 (make-adder 7)))
            (list (funcall f1 2) (funcall f2 2)
                  (funcall f1 5) (funcall f2 5))))

        (defun test-adder ()
          (let ((f1 (make-adder 3))
                (f2 (make-adder 7)))
            (list (apply f1 2 '()) (apply f2 2 '())
                  (apply f1 5 '()) (apply f2 5 '()))))

        (defun test-adder ()
          (let ((f1 (make-adder 3))
                (f2 (make-adder 7)))
            (list (apply f1 '(2)) (apply f2 '(2))
                  (apply f1 '(5)) (apply f2 '(5)))))

-Rob

-----
Rob Warnock, PP-ASEL-IA         <r...@rpw3.org>
627 26th Avenue                 <URL:http://www.rpw3.org/>
San Mateo, CA 94403             (650)572-2607


 
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.
Ingvar Mattsson  
View profile  
 More options Sep 11 2002, 8:35 am
Newsgroups: comp.lang.lisp
From: Ingvar Mattsson <ing...@cathouse.bofh.se>
Date: 11 Sep 2002 13:32:48 +0100
Local: Wed, Sep 11 2002 8:32 am
Subject: Re: special variables

r...@rpw3.org (Rob Warnock) writes:
> Ingvar Mattsson  <ing...@cathouse.bofh.se> wrote:
> +---------------
> | (defun test-adder ()
> |   (let ((f1 (make-adder 3))
> |         (f2 (make-adder 7)))
> |     (list (apply f1 2) (apply f2 2) (apply f1 5) (apply f2 5))))
> +---------------

> Typo? I think you meant one of the following alternatives, yes?

Yes, I did mean FUNCALL instead of APPLY. *sigh* I should really test
code before posting atricles. For *some* bizarre reason, I actually
started out with FUNCALL and then changed it to APPLY, in a fit of
incredible stupidity.

//Ingvar
--
(defun m (a b) (cond ((or a b) (cons (car a) (m b (cdr a)))) (t ())))


 
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.
End of messages < Older 
« Back to Discussions « Newer topic     Older topic »