I'd like to organize a "100 days of Common Lisp" (inspired by 100 days of Swift).
I'll use this as a scratch space to collect resources and organize my thoughts.
TODO:
- atoms: numbers, strings
- symbols, binding using
setq
- list evaluation,
(+ 1 1)
etc - quote
- declaring functions, lambda
- lists
- vectors
- alists
- hash tables
resources to use:
On a Mac, install Homebrew and then use Homebrew to install CLISP.
- Open a terminal
- Run
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Run
brew install clisp
- Run
clisp
- Hit CTRL+d (or type
(quit)
at the REPL prompt) to exit CLISP.
- Hit CTRL+d (or type
When you run clisp
, it starts a REPL (read-eval-print loop), where you can type in Common Lisp code and have it executed.
Try typing in (+ 1 1)
, which should evaluate to 2
:
[1]> (+ 1 1)
2
Try typing in foo
:
[2]> foo
*** - SYSTEM::READ-EVAL-PRINT: variable FOO has no value
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of FOO.
STORE-VALUE :R2 Input a new value for FOO.
ABORT :R3 Abort main loop
Break 1 [3]>
Here we see a condition bring thrown (called exceptions in other languages), which starts the debugger.
You can always exit the debugger by hitting CTRL
+d
.
Download the Atom editor.
Install the SLIMA package.
Set up (or memorize) key bindings for compiling and evaluating forms.
The HyperSpec describes the 1994 ANSI standardization of Common Lisp (which is the most recent version of Common Lisp).
The list of all symbols is very useful.
See https://jtra.cz/stuff/lisp/sclr/index.html
See https://github.com/ashok-khanna/lisp-notes
See http://csci.viu.ca/~wesselsd/courses/csci330/code/lisp/
See https://lispcookbook.github.io/cl-cookbook/
See https://github.com/40ants/lisp-project-of-the-day
See:
- https://common-lisp-libraries.readthedocs.io/
- https://github.com/cl-library-docs/common-lisp-libraries
See https://phoe.tymoon.eu/clus/doku.php?id=articles:manifesto
Quicklisp is the defacto package manager for Common Lisp.
Quickdocs is a documentation portal for quicklisp packages.
Xach publishes a Quicklisp news blog which highlights newly added projects. Check it out and consider subscribing to stay on top of new libraries.
See https://common-lisp.net/project/asdf/
- Video by Baggers: Common Lisp - How to Start a New Project
- Video by Atlanta Functional Programming : Common Lisp Study Group : Introduction to ASDF 05-08-2018
- Video by Neil Munro: Common Lisp Tutorial 9b: ASDF
See https://roswell.github.io/Home.html
Occaisionally, Xach publishes a blog post with quicklisp project download stats, which you can use to figure out which quicklisp libraries are most commonly used. http://blog.quicklisp.org/2018/03/download-stats-for-february-2018.html
See also https://github.com/phoe/quicklisp-stats
See also https://www.quicklisp.org/stats/2021/2021-12.csv
See https://common-lisp.net/project/alexandria/draft/alexandria.html
See https://lisp-lang.org/learn/
See https://gigamonkeys.com/book/
See - https://exercism.org/tracks/common-lisp
See https://common-lisp.net/project/bordeaux-threads/
See:
See https://stackoverflow.com/questions/33848241/most-recent-standard-of-common-lisp
- https://github.com/iamFIREcracker/adventofcode
- https://www.reddit.com/r/adventofcode/comments/kvhnpa/2020_all_parts_completed_common_lisp/
- https://www.reddit.com/r/adventofcode/comments/7nq4h0/all_solutions_using_common_lisp/
See https://www.youtube.com/c/NeilMunro/videos
eq
, eql
, equal
, equalp
, =
, char=
, char-equal
, string=
, string-equal
=
only works on numbers, will match ints and floatseq
is t for same, identical objectseql
iseq
+ numbers (same type) + charactersequal
iseql
+ deep list comparison,equalp
also arrays, structures, hash tables, but is case insensitive?!?
(set 'a 1)
(setq a 1)
(setf (symbol-value 'a) 1)
(boundp 'a)
,(makunbound 'a)
note: set
doesn't work with lexical variables, but setq
does.
symbol-value
(setf (symbol-value 'a) 1)
Aliasing evenp as even?:
(setf (fdefinition 'even?) #'evenp)
a.k.a.
(setf (fdefinition (quote even?)) (function evenp))
See https://gist.github.com/cellularmitosis/e2d6362375e536d8d1e154e3b73c86c3