Artifical Intelligence Fall 2006
NameDescriptionSample Usage
celcius-to-fahrenheit
sample solution
Write a function that converts from celcius to fahrenheit. The formula is F = C * 9/5 + 32.
(celcius-to-fahrenheit 100)
;Value 212
 
area
sample solution
write a function that will compute the area of a circle given the radius.
(area 3)
;Value: 28.26
 
circumference
sample solution
Write a function that will compute the circumference of a circle given the radius
(circumference 1)
;Value: 6.28
 
circlestuff
sample solution
Write a function that will compute both the area and circumference, and returns both as a list (with area first).
(circlestuff 3)
;Value 11: (28.26 18.84)
 
solvequad
sample solution

Write a function that will generate a list of two elements, each element is a root of the quadratic equation given by:

 ax**2 + bx + c

a,b and c are the arguments to the function

(solvequad 1 1 -2)
;Value 15: (1 -2)
 
mylength
sample solution
Write a function that returns the length of a list (without using the scheme length function).
(mylength '( a b c))
;Value 3
 
listsum
sample solution
Write a function that sums the numbers in a list.
(listsum '(1 2 3 4 5 4 3 2 1))
;Value 25
 
myreverse
sample solution
Write a function that reverses a list (without using the scheme reverse function).
(myreverse '( a 3 b))
;Value (b 3 a)
 
count-elem
sample solution
Write a function that will count the number of elements in a list that have a specific value. The first argument is the value to look for, the second is the list
;; how many 3s are there in the list (1 2 3 4 5 4 3 2 1) ?
(count-elem 3 '(1 2 3 4 5 4 3 2 1 ))
;Value 2
 
factorial
sample solution
Write a function that computes factorials You can assume that a positive integer is passed in.
(factorial 3)
; Value 6
 
distance
sample solution
Write a function that determines the distance between two points The coordinates of the point are represented as a list (x y)
(distance '(-2 -3) '(-4 4))
;Value: 7.280109889280518