Newsgroups: comp.lang.lisp.mcl
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!portc01.blue.aol.com!news-res.gsl.net!news.gsl.net!news-peer.gsl.net!news.gsl.net!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!newsfeed.internetmci.com!in1.uu.net!EU.net!usenet2.news.uk.psi.net!uknet!usenet1.news.uk.psi.net!uknet!uknet!strath-cs!info!news
From: @lamp.ac.uk
Subject: Lisp
Content-Type: text/plain; charset=us-ascii; name="RAHMAH.DOC"
Message-ID: <3234DF24.5CAB@lamp.ac.uk>
Content-Disposition: inline; filename="RAHMAH.DOC"
Sender: news@exeter.ac.uk (news admin)
Content-Transfer-Encoding: 7bit
Organization: University of Wales, Lampeter
Mime-Version: 1.0
Date: Tue, 10 Sep 1996 03:23:16 GMT
X-Mailer: Mozilla 3.0 (Win16; I)
Lines: 145

ࡱ4@
&D&U&T&]&\&]&\&]&\&M	&LF&E&UF
&D&T+^_&Eu+5&5FPj0ǋu F&u
&uFP&u&u+^_
Will any of you guys help me out with these problems
that has been to long in the tooth to solve. The sad thing
is I have completed more complex problems than this 8
months ago but it was a self teaching crash course. I now
cant believe how such relatively simple problems now 
seems so daunting. Somebody save my insanity, please.


Best Wishes
Adam Faith.

My e-mail is:   NM322@lamp.ac.uk



Problem 1
-----------
Write a LISP funtion    average-2    which calculates the average of two numbers.
For example:

(average-2 8 6) should return 7

What is the value of (average-2 5 6) ?


Problem 2
------------
Write a LISP funtion    add-first-2    which takes a list of numbers as its parameter and
adds together the first two numbers in the list. For example:

(add-first-two (3 8 7 4 5)) should return 11

Problem 3
------------
Write a LISP funtion    add-and-square    which takes two numbers as parameters
adds them together and then squares the result. For example:

(add-and-square 3 4) should return 49

Problem 4
-----------
Write a LISP funtion    square-and-add    which takes two numbers as
parameters, squares them and then adds the results. For example:

(square-and-add 3 4) should return 25

Problem 5
-----------
Write a LISP funtion    write-number    which takes a number between
0 and 9 as its parameter, and return the written value of the number.
For example:

(write-number 6) should return six

Hint: Dont use an enormous cond.

Problem 6
-----------
Write a LISP funtion    decompose-number    which takes a number
between 10 and 99 as its parameter, and returns a list consisting of the
number of tens making up the number, and the number of units.
For example:

(decompose-number 56) should return (5 6)

Hint: The funtion    mod    calculates the remainder of a division,
for example    (mod 56 10) returns 6


Will any of you guys help me out with these problems
that has been to long in the tooth to solve. The sad thing
is I have completed more complex problems than this 8
months ago but it was a self teaching crash course. I now
cant believe how such relatively simple problems now 
seems so daunting. Somebody save my insanity, please.


Best Wishes
Adam Faith.

My e-mail is:   NM322@lamp.ac.uk



Problem 1
-----------
Write a LISP funtion    average-2    which calculates the average of two numbers.
For example:

(average-2 8 6) should return 7

What is the value of (average-2 5 6) ?


Problem 2
------------
Write a LISP funtion    add-first-2    which takes a list of numbers as its parameter and
adds together the first two numbers in the list. For example:

(add-first-two (3 8 7 4 5)) should return 11

Problem 3
------------
Write a LISP funtion    add-and-square    which takes two numbers as parameters
adds them together and then squares the result. For example:

(add-and-square 3 4) should return 49

Problem 4
-----------
Write a LISP funtion    square-and-add    which takes two numbers as
parameters, squares them and then adds the results. For example:

(square-and-add 3 4) should return 25

Problem 5
-----------
Write a LISP funtion    write-number    which takes a number between
0 and 9 as its parameter, and return the written value of the number.
For example:

(write-number 6) should return six

Hint: Dont use an enormous cond.

Problem 6
-----------
Write a LISP funtion    decompose-number    which takes a number
between 10 and 99 as its parameter, and returns a list consisting of the
number of tens making up the number, and the number of units.
For example:

(decompose-number 56) should return (5 6)

Hint: The funtion    mod    calculates the remainder of a division,
for example    (mod 56 10) returns 6

D:\A-NAME.DOCAcademic Computing Service.
D:\A-MAIL.HTMAcademic Computing Service.
D:\A-MAIL.DOCMary Elizabeth Stewart
D:\RAHMAH.DOC@Digital PrintServer 20/turboWDWD
