📓 Notes
Lisp

Notes on Common Lisp

SBCL is an open-source implementation that is delivered from Carnigie Mellon University. This is the version that I'm currently using.

Resources:

Concepts

  • Read-Eval-Print Loop: That endless cycle of reading, evaluating, and printing (REPL).
  • Self-evaluating object: Which means that when given to the evaluator, the E in REPL, it evaluates to itself.
  • List: Anything in parenthesis.
  • NIL: Lisp's version of false and/or null.
  • Functions: Basic program building blocks in Lisp and can be defined with a DEFUN.
  • FORMAT: function is the most flexible way to standar output.
  • T: Means everything loaded correctly

Notes - Apr 11, 2023

Lisp, in general, evaluates lists by treating the first element as the name of a function and the rest of the elements as expressions to be evaluated to yield the arguments to the function.

Strings, like numbers, have a literal syntax that's understood by the Lisp reader and are self-evaluating objects.

FORMAT function is the most flexible way to standar output. FORMAT takes a variable number of arguments, but the only two required arguments are the place to send the output and a string. If you pass t as its first argument, it sends its output to standard output.

;HELLO WORLD VARIABLE
"Hello, World!"
;FULL HELLO, WORLD PROGRAM
(FORMAT t "Hello, World!")
;FULL HELLO, WORLD PROGRAM PACKED IN A FUNCTION
(defun hello-world () (format t "hello, world"))
 
;CALLING THE CREATED FUNCTION
(hello-world)

Debugging a program running on a $100M piece of hardware that is 100 million miles away is an interesting experience. Having a read-eval-print loop running on the spacecraft proved invaluable in finding and fixing the problem.

source (opens in a new tab)