[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

What could replace x in the following exchanges ?

gengyangcai

11/15/2015 3:47:00 PM

What could occur in place of the x in each of the following exchanges?

(a) > (car (x (cdr '(a (b c) d))))
B
(b) > (x 13 (/ 1 0))
13
(c) > (x #>list 1 nil)
(1)
1 Answer

Pascal J. Bourguignon

11/15/2015 8:29:00 PM

0

CAI GENGYANG <gengyangcai@gmail.com> writes:

> What could occur in place of the x in each of the following exchanges?
>
> (a) > (car (x (cdr '(a (b c) d))))
> B
> (b) > (x 13 (/ 1 0))
> 13
> (c) > (x #>list 1 nil)
> (1)


Besides, what would be the use for us to respond to your exercises?
We know the answer. The problem is that you are not thinking and
searching to find the answer yourself. Therefore you will never learn,
and you will ask the same questions again and again.


First, you should read, memorize, and understand a lisp tutorial.
Either the book where you are reading this exercises told you what CAR
and CDR were, or it expects you to find out by yourself. In the later
case, go read CLHS
http://www.lispworks.com/documentation/HyperS...

Then knowing what CAR and CDR are, you should be able to undestand
expression (a) as an equation with X being the unknown. It's rather a
simple equation, and you should be able to solve it using substitution
techniques that you should have learned when you were taught arithmetic.

Similarly, for equation (b), where you should have noticed that (/ 1 0)
is a form that signals a DIVIDE-BY-ZERO error, and therefore it should
either not be evaluated, or if evaluated, its error should be ignored.

As for equation (c), #> is invalid syntax. Therefore you should either
be able to handle reader error while reading the form, or you should be
able to understand what typo has been made, and correct it before
solving the equation.

--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk