Example of ´the´

This commit is contained in:
Erik Svedäng 2019-03-07 14:16:31 +01:00
parent d09fb4d0dc
commit d48df1fd1f

View File

@ -76,7 +76,14 @@ and other static analysis. The first three of them are also available in dynamic
(ref <expression>) ;; Borrow an owned value
(address <expression>) ;; Takes the memory address of a value, returns a C-style pointer
(set! <variable> <expression>) ;; Mutate a variable
(the Int <expression>) ;; Explicitly declare the type of an expression
(the <type> <expression>) ;; Explicitly declare the type of an expression
```
Here's an example of how to use the `the` form to make an identity function that only accepts Integers:
```clojure
(defn f [x]
(the Int x))
```
### Reader Macros