[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Chapter 3.2 of OnLisp --- Imperative Outside-In

gengyangcai

9/28/2015 1:12:00 PM

CL-USER 1 >
(defun fun (x)
(list 'a (expt (car x) 2)))
FUN

CL-USER 2 > (defun imp (x) (let (y sqr)
(setq y (car x)) (setq sqr (expt y 2)) (list 'a sqr)))
IMP

CL-USER 3 > (list 'a (expt y 2))
Error: The variable Y is unbound.
1 (continue) Try evaluating Y again.
2 Return the value of :Y instead.
3 Specify a value to use this time instead of evaluating Y.
4 Specify a value to set Y to.
5 (abort) Return to level 0.
6 Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.)

CL-USER 4 : 1 > (list 'a (expt (car x) 2))

Error: The variable X is unbound.
1 (continue) Try evaluating X again.
2 Return the value of :X instead.
3 Specify a value to use this time instead of evaluating X.
4 Specify a value to set X to.
5 (abort) Return to level 1.
6 Return to debug level 1.
7 Return to level 0.
8 Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 5 : 2 >
1 Answer

Barry Margolin

9/29/2015 2:39:00 AM

0

Do you have a question? You seem to be posting lots of threads where you
just paste in transactipts of your Lisp sessions, with no specific
questions being asked about them. What's the deal?

When you paste function definitions, please try to indent them nicely
(and don't use tabs for indentation, as we don't all have the same tab
stops).

In article <ecadd907-1127-4489-ae8c-38dc72af14f8@googlegroups.com>,
CAI GENGYANG <gengyangcai@gmail.com> wrote:

> CL-USER 1 >
> (defun fun (x)
> (list 'a (expt (car x) 2)))
> FUN
>
> CL-USER 2 > (defun imp (x) (let (y sqr)
> (setq y (car x)) (setq sqr (expt y 2)) (list 'a sqr)))
> IMP
>
> CL-USER 3 > (list 'a (expt y 2))
> Error: The variable Y is unbound.
> 1 (continue) Try evaluating Y again.
> 2 Return the value of :Y instead.
> 3 Specify a value to use this time instead of evaluating Y.
> 4 Specify a value to set Y to.
> 5 (abort) Return to level 0.
> 6 Return to top loop level 0.
>
> Type :b for backtrace or :c <option number> to proceed.
> Type :bug-form "<subject>" for a bug report template or :? for other options.)
>
> CL-USER 4 : 1 > (list 'a (expt (car x) 2))
>
> Error: The variable X is unbound.
> 1 (continue) Try evaluating X again.
> 2 Return the value of :X instead.
> 3 Specify a value to use this time instead of evaluating X.
> 4 Specify a value to set X to.
> 5 (abort) Return to level 1.
> 6 Return to debug level 1.
> 7 Return to level 0.
> 8 Return to top loop level 0.
>
> Type :b for backtrace or :c <option number> to proceed.
> Type :bug-form "<subject>" for a bug report template or :? for other options.
>
> CL-USER 5 : 2 >

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***