hello("world")
(hello "world")
(+ 3 (+ 1 2))
(+ 3 1 2)
(/ 4 (+ 1 2))
(defvar me "nico")
(setq me "Nicolas")
(insert "Hello")
(insert "Hello" " world!")
(defun hello (name)
"Doc string"
(insert "Hello from " name))
(hello me)
(let ((name "HAL"))
(hello name))
(format "Hello, %s" "you")
(defun hello (name)
(format "Hello from %s!\n" name))
(defvar list-of-names '("nicolas" "benjamin" "henrik"))
(cons "mikael" list-of-names)
(push "mikael" list-of-names)
(setq var (cons new-value var))
(car list-of-names)
(cdr list-of-names)
(listp nil)
(null nil)
(if nil
'truthy
'falsy)
(if 'non-nil
'truthy
'falsy)
(defun greetings-from (names)
(mapcar #'hello names))
(greetings-from list-of-names)
'hello
(eq 'hello 'hello)
(eq "hello" "hello")
(symbol-name 'hello)
(intern "hello")
(eq (intern "hello") 'hello)
(make-symbol "hello")
(eq (make-symbol "hello") 'hello)
'(+ 1 2) (+ 1 2) 't t '1 1
`(foo ,emacs-version bar)
'(+ 1 2 3)
(eval '(+ 1 2 3))
(+ 1 2 3)
(3 2 1 +)
(defmacro postfixed (list)
(reverse list))
(postfixed (1 2 3 +))
(macroexpand '(postfixed (1 2 3 +)))
(defmacro inc (n)
(list 'setq n (list '+ n 1)))
(defmacro inc (n)
`(setq ,n (+ ,n 1)))
(macroexpand '(inc foo))
(defvar val 3)
(inc val)
val
(defmacro if-not (condition then else)
`(if (not ,condition)
,then
,else))
(defmacro dorepeat (n form) `(let ((max 0))
(while (< max ,n)
,form
(inc max))))
(dorepeat 5 (inc val))
(defvar max 0)
(dorepeat 5 (inc max))
max
(macroexpand '(dorepeat 5 (inc max)))
(defmacro dorepeat (n form)
(let ((max (make-symbol "max")))
`(let ((,max 0))
(while (< ,max ,n)
,form
(inc ,max)))))
(dorepeat 5 (inc max))