Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8401179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:44:21+00:00 2026-06-09T21:44:21+00:00

In some docs,I found that they say the answer is *var* means global variable.

  • 0

In some docs,I found that they say the answer is *var* means global variable.

But when I try, I couldn’t make sure that.

  FIRST-PACKAGE[27]> (defvar b 1)
  B
  FIRST-PACKAGE[28]> b
  1
  FIRST-PACKAGE[29]> (defun add_b (x) (+ x b))
  ADD_B
  FIRST-PACKAGE[30]> (add_b 3)
  4
  FIRST-PACKAGE[31]>

In my example, b is still not global if that answer is right.

But why the function add_b still can use it?

How to understand this example and *var*?

Thank you~

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:44:23+00:00Added an answer on June 9, 2026 at 9:44 pm

    All right. In Common Lisp there are effectively two types of variables: the ones you use all the time, which are lexically bound, and “special” variables, which are dynamically bound. “Special” variables are created with defvar, defparameter, or a declaration. The *earmuffs* are a convention that exists to remind Lisp programmers that a variable is special. Here are some examples:

    (defvar b 3)
    
    (defun add-to-b (x)
      (+ x b))
    
    (add-to-b 1)
      => 4
    
    (let ((b 4))
      (list (add-to-b 1) b))
    => (5 4)
    
    (let ((a 3))
      (defun add-to-a (x)
        (+ x a)))
    
    (add-to-a 1)
      => 4
    
    (let ((a 4))
      (list (add-to-a 1) a))
    => (4 4)
    

    As you can see, changing the value of a special variable in a let makes the value change “trickle down” to all of the function calls in that let, while value changes of a regular, lexically-bound variable don’t get passed down, In fact, lexically bound variables are looked up by moving up the scopes that are located where the function wan defined, while special variables are looked up by moving up the scopes where the function was called. The *earmuffs* are useful to stop programmers from accidentally rebinding a special variable, because they make special variables look different.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found that some application, like GoodReader or Docs to Go, once installed can
I'm new to jQuery. I've searched and found some results that might work, but
I am working with some css animation. But I found that, the CSS transition
I've read some docs about the .NET Garbage Collector but i still have some
I was reading the docs and some questions around here and couldn't understand how
I review docs but I am lost... some problem with it: {% load i18n
I've found lots of tutorials for using pygame, and its font library, but they
As far as I know, they are absolute equal. However, browsing some django docs,
There are some documents to be indexed, that means I need to read the
In an IPython notebook, when you look at some docs with ? or help()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.