10.07.2015 Views

An Introduction to Functional Programming Through Lambda Calculus

An Introduction to Functional Programming Through Lambda Calculus

An Introduction to Functional Programming Through Lambda Calculus

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

- 241 -(if (= m1 m2)(if (< s1 s2)tnil)nil))nil)))))(defun tinsert (tr l)(cond ((null l) (cons tr nil))((tless tr (car l)) (cons tr l))(t (cons (car l) (tinsert tr (cdr l))))))(defun tsort (l)(if (null l)l(tinsert (car l) (tsort (cdr l)))))5)i) (defun tcomp (t1 t2)(cond ((and (null t1) (null t2)) t)((or (null t1) (null t2)) nil)((= (item t1) (item t2)) (and (tcomp (left t1) (left t2))(tcomp (right t1) (right t2))))(t nil)))ii) (defun tfind (t1 t2)(cond ((null t1) t)((null t2) nil)((tcomp t1 t2) t)((< (item t1) (item t2)) (tfind t1 (left t2)))(t (tfind t1 (right t2)))))iii) (defun dtraverse (tree)(if (null tree)nil(append (dtraverse (right tree))(cons (item tree) (dtraverse (left tree))))))

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!