mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
Example of ´the´
This commit is contained in:
parent
d09fb4d0dc
commit
d48df1fd1f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user