My Technical Notes

Wednesday, 16 March 2016

Elisp: Simple Let Statement

Simple Let Statement


(let ((a 3)) a)

The first argument to let, the variable binding, seems to be a list, therefore we have another set of brackets enclosing it.

Let Statement with two bindings


(let ((a 3) (b 4)) (+ a b))

In this example we bind `a` to `3` and `b` to `4` and return `(+ a b)`. A binding is a pair of the form, `(<variable-name> <value>)`, and all the bindings are housed in a pair of brackets. This explains why, in the first example, we needed a supposedly extra pair of brackets around the binding `(a 3)`.

References

No comments: