#+title: Lisp primitives - tags :: [[file:20200604222651-lisp.org][Lisp]] [[file:20210307152738-programming_languages.org][programming languages]] [[file:20210314131218-dial.org][Dial]] [[file:20210403130721-dial_implementation.org][Dial implementation]] When implementing a Lisp in particular, the goal should be to express the totality of the Lisp with only a minimal set of implementation language code. For example, it wouldn't make a lot of sense to implement =when= in the source language (say, C) when, if =if= is implemented, it could be expressed as =if=[fn:1]. Primitives include but are not limited to: - Basic data types - Any arithmetic - =lambda= or equivalent - =if= - =cond= - =list= - =apply= - =defmacro= - =quote= The rest of a Lisp is simply library code, which can be expressed using all of the above. * Footnotes [fn:1] In fact, it could be expressed like this: #+begin_src emacs-lisp ; a copy of emacs's own =when= definition (defmacro my-when (condition &rest body) (list 'if condition (cons 'progn body))) (macroexpand '(my-when t (message "hello world I did it"))) #+end_src