616Re: [aima-talk] Complex returns from recursive functions - tail recursion?
- Jan 29, 2006Here's version that's tail recursive though I don't think very
efficient because of my use of append and list perhaps were not
(defun split-list2 (list)
(let ((a (list)) (b (list)))
(split-list2-helper list a b)))
(defun split-list2-helper (list firsts seconds)
(cond ((null list) (list firsts seconds))
(rest (rest list))
(append firsts (list (first list)))
(append seconds (list (second list)))))))
Also, I forget the syntax for defining inner auxilary functions...
flet, labels, defun??...
- << Previous post in topic Next post in topic >>