exercism-common-lisp/socks-and-sexprs/socks-and-sexprs.lisp
Adam Cooper 577860559e Initial commit
This "initial" commit occurs after five exercises have been completed
2025-01-23 19:43:42 -05:00

43 lines
1,015 B
Common Lisp

(defpackage :socks-and-sexprs
(:use :cl)
(:export :lennys-favorite-food :lennys-secret-keyword
:is-an-atom-p :is-a-cons-p :first-thing :rest-of-it))
(in-package :socks-and-sexprs)
;; Evaluates to some symbol (not a keyword)
(defun lennys-favorite-food ()
;; put your symbol here
'bibimbap
)
;; Evaluates to some keyword
(defun lennys-secret-keyword ()
;; put your keyword here
:nil
)
;; Evaluates to T if THING is an atom, NIL otherwise
(defun is-an-atom-p (thing)
;; put the code to determine if THING is an atom here
; (atom thing)
(not (consp thing))
)
;; Evaluates to T if THING is a cons, NIL otherwise
(defun is-a-cons-p (thing)
;; put the code to determine if THING is a CONS here
(consp thing)
)
;; Evaluates to the first part of CONS
(defun first-thing (cons)
;; put the code to get the first part of CONS here
(car cons)
)
;; Evaluates to the 'rest' of the CONS
(defun rest-of-it (cons)
;; put the code to get the rest of CONS here
(cdr cons)
)