Subversion Repositories programming

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
70 irasnyd 1
irasnyd@duallie lisp $ cat hw09.lisp
2
;Written By: Ira Snyder
3
;Due Date: 02-14-2005
4
;Homework #: Hw09 (Exercise #13)
5
 
6
;;; My assumption on this homework is that you meant to
7
;;; mean that I should make an iterative version of NONE
8
;;; from Exercise 11 (HW06), not AL1 from Exercise 6.
9
(defun NONE (L)
10
  (do ((L L (cdr L))
11
       (NO 0)
12
       (NE 0))
13
      ((null L) (list NO NE))
14
    (if (oddp (car L)) (setf NO (1+ NO)) (setf NE (1+ NE)))
15
  )
16
)
17
 
18
irasnyd@duallie lisp $ clisp -q
19
 
20
[1]> (load 'hw09.lisp)
21
;; Loading file hw09.lisp ...
22
;; Loaded file hw09.lisp
23
T
24
[2]> (none nil)
25
(0 0)
26
[3]> (none '(3))
27
(1 0)
28
[4]> (none '(2))
29
(0 1)
30
[5]> (none '(3 1 4 1 5))
31
(4 1)
32
[6]> (bye)
33
irasnyd@duallie lisp $ 
34