[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.2 Functional languages: Lisp101

Setup

Perform the weekly set up instructions for project 1, homework b.

What to hand in

Report (a) all the lisp functions you’ve written and (b) a file containing your deftests and (c) ‘repl.txt’ coming from you saving the REPL showing these all running.

Basic LISP

Write LISP functions to implement the following:

(deftest !count-of ()
	(test 3
		(count-of 'a '(a b  (c d  a) (e a)))))

(deftest !sum-of ()
	(test 28
		(sum-of '(1 2  (3 4 5) (6 7)))))

(deftest !oddd-of ()
	(test 4
		(odd-of '(1 2  (3 4 5) (6 7)))))

Note for the above:

(deftest !odd-arr ()
	(test '(1 3 5 7)
		(odd-of '(1 2  (3 4 5) (6 7)))))

Make a Story

Load ‘1/b/boot.lisp’ into lisp and run (!generate1). To understand what is going on here, look at ‘1/b/grammars.lisp’.

Write a new set of rules into ‘0/b/grammars’ called *grammar3* that describes different menus at Bits ’n Bites. No more than 5 rules. Using those rules, generate some meals.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 19, 2011 using texi2html 5.0.