(defun my-print-hello-world () (print "Hello. World")) ;(my-print-hello-world) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun polynomial (a b c x) (+ (* a (* x x)) (* b x) c)) (defun polynomial2 (a b c x) (let ((first-term (* a (* x x))) (second-term (* b x))) (+ first-term second-term c))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun my-compile-and-load1 (file-arg) (load (compile-file file-arg)) (defun my-compile-and-load2 (file-arg) (let ((compiled-file (compile-file file-arg))) (load compiled-file))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun list-second-and-fourth-elements (things) (list (second things) (fourth things))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun list-second-and-fourth-elements2 (things) (list (nth 1 things) (nth 3 things))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun list-some-2-list-elements (an-integer a-second-integer somelist) (list (nth an-integer somelist) (nth a-second-integer somelist))) (defun list-some-2-list-elements2 (an-integer a-second-integer somelist) (format t "There are ~s elements in ~ ~s" (length somelist) somelist) (list (nth an-integer somelist) (nth a-second-integer somelist))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun list-first-and-rest-of-argument (list-arg) (list (first list-arg) (rest list-arg))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun rest-of-the-list (some-thing list-of-things) (rest (member some-thing list-of-things))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun print-em (alpha beta &optional gamma delta) (print alpha) (print beta) (print gamma) (print delta)) ;;example of a call to print-em with 2 non-integer arguments (print-em 'horse (* 3 .5)) ;;example of a call to print-em with 3 arguments, not all of them integers (print-em 'cadillac 12 1957) ;;example of a call to print-em with 4 arguments (print-em 2 3 5 7) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun doit (alpha beta &key gamma delta) (print alpha) (print beta) (print gamma) (print delta)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun doit2 (alpha beta &rest all-the-others) (print alpha) (print beta) (print all-the-others))