[Solved] Creating a method in Common Lisp

To create a function in common lisp you can use the defun operator: (defun signal-error (msg) (error msg)) Now you can call it like so: (signal-error “This message will be signalled as the error message”) Then you can insert it in your code like this: (print “Enter number”) (setq number (read)) ;; <- note that … Read more

[Solved] creating assoc function in lisp that will find value from a-list

The most basic lisp operations are list eaters: (defun some-function (list-to-consume perhaps-additional-args) (cond ((endp list-to-consume) <end-of-list-expression>) ((<predicate> list-to-consume perhaps-additional-args) <result-expression>) (t (some-function (cdr list-to-consume) perhaps-additional-args)))) Examples: ;; The predicate is the endp expression (defun mylength (list &optional (len 0)) (cond ((endp list) len) (t (mylength (cdr list) (1+ len))))) ;; A member function (defun mymember … Read more