Subversion Repositories programming

Rev

Rev 431 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 431 Rev 432
Line 22... Line 22...
22
;;; Problem 1
22
;;; Problem 1
23
;;;
23
;;;
24
;;; The example output given in the homework assignment page is incorrect,
24
;;; The example output given in the homework assignment page is incorrect,
25
;;; according to the description. The description states that we should keep
25
;;; according to the description. The description states that we should keep
26
;;; anything that is strictly less than LO, and strictly higher than HI. The
26
;;; anything that is strictly less than LO, and strictly higher than HI. The
27
;;; example output for (list_outliers 3 10 '(3 5 1 9 11 30)) contains 3, which
27
;;; example output for (list_outliers 10 3 '(3 5 1 9 11 30)) contains 3, which
28
;;; is incorrect, since it is not strictly less than LO, which is 3.
28
;;; is incorrect, since it is not strictly less than LO, which is 3.
29
(defun LIST_OUTLIERS (LO HI LI)
29
(defun LIST_OUTLIERS (HI LO LI)
30
  (cond
30
  (cond
31
    ((null LI)                            nil)
31
    ((null LI)                            nil)
32
    ((or (< LO (car LI)) (> HI (car LI))) (cons (car LI) (LIST_OUTLIERS LO HI (cdr LI))))
32
    ((or (< (car LI) LO) (> (car LI) HI)) (cons (car LI) (LIST_OUTLIERS HI LO (cdr LI))))
33
    (t                                    (LIST_OUTLIERS LO HI (cdr LI)))
33
    (t                                    (LIST_OUTLIERS HI LO (cdr LI)))
34
  )
34
  )
35
)
35
)
36
 
36
 
37
;;; Problem 2
37
;;; Problem 2
38
(defun dolist_reverse (LI)
38
(defun dolist_reverse (LI)