Skip to content

Instantly share code, notes, and snippets.

@linuxsable
Created March 3, 2013 01:40
Show Gist options
  • Select an option

  • Save linuxsable/5074097 to your computer and use it in GitHub Desktop.

Select an option

Save linuxsable/5074097 to your computer and use it in GitHub Desktop.
(defun my-length (list)
(if list
(1+ (my-length (cdr list)))
0))
(assert (eq (my-length '(1 2 3)) 3))
(assert (eq (my-length (list 234)) 1))
(defvar *number-was-odd* nil)
(if (oddp 5)
(progn (setf *number-was-odd* t)
'odd-number)
'even-number)
(assert (eq *number-was-odd* t))
(defvar *number-is-odd* nil)
(when (oddp 5)
(setf *number-is-odd* t)
'odd-number)
(assert (eq *number-is-odd* t))
(unless (oddp 4)
(setf *number-is-odd* nil)
'even-number)
(assert (eq *number-is-odd* nil))
(print "TESTS OK")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment