mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-11 20:49:05 +03:00
example of generic structs
This commit is contained in:
parent
bbc71a57aa
commit
a64027bf93
12
LANGUAGE.md
12
LANGUAGE.md
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user