example of generic structs

This commit is contained in:
Erik 2016-06-01 18:58:26 +02:00
parent bbc71a57aa
commit a64027bf93

View File

@ -128,6 +128,18 @@ foo ; symbol
(update-x my-pos inc) ;; => (Vector2 10.2f 4.0f)
```
Structs can also contain members of one or more generic types:
```clojure
(defstruct Pair
[a "t"
b "t"])
(defstruct Tuple
[a "a"
b "b"])
```
### Algebraic Data Types (not implemented)
```clojure
(defdata Color