mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
Add length checks to struct? and sumtype? for safety
This commit is contained in:
parent
9a0a061192
commit
095866e45f
@ -40,7 +40,9 @@
|
||||
(let [s (s-expr binding)]
|
||||
(if (empty? s)
|
||||
false
|
||||
(array? (caddr s)))))
|
||||
(if (< (length s) 2)
|
||||
false
|
||||
(array? (caddr s))))))
|
||||
|
||||
(doc sumtype?
|
||||
"Is this binding a sumtype?")
|
||||
@ -48,7 +50,9 @@
|
||||
(let [s (s-expr binding)]
|
||||
(if (empty? s)
|
||||
false
|
||||
(list? (caddr s)))))
|
||||
(if (< (length s) 2)
|
||||
false
|
||||
(list? (caddr s))))))
|
||||
|
||||
(doc arity
|
||||
"What's the arity of this binding?
|
||||
|
Loading…
Reference in New Issue
Block a user