3 ms·
There is nothing which would require me to use Clojure to check those things. For example... one can easily express all that in Common Lisp: https://www.lispw
by lispm 2y ago
There is nothing which would require me to use Clojure to check those things.
For example... one can easily express all that in Common Lisp:
https://www.lispworks.com/documentation/HyperSpec/Body/04_b.htm https://www.lispworks.com/documentation/HyperSpec/Body/04_b....
CL-USER 9 > (defun non-empty-string-p (string) (and (stringp string) (plusp (length string))))
NON-EMPTY-STRING-P
CL-USER 10 > (deftype name-type () `(and string (satisfies non-empty-string-p)))
NAME-TYPE
CL-USER 11 > (deftype age-type () `(integer 18 120))
AGE-TYPE
CL-USER 12 > (defun foo (age name)
(declare (type age-type age)
(type name-type name))
(print (list age name)))
FOO
also, avoiding SATISFIES:
CL-USER 4 > (deftype name-type () `(and string (not (string 0))))
NAME-TYPE
CL-USER 5 > (typep "hello" 'name-type)
T
CL-USER 6 > (typep "" 'name-type)
NIL
It then has assertions integrated with the condition system, which makes this easily checkable at runtime.
SBCL has this extended with type declarations as assertions: http://sbcl.org/manual/index.html#Handling-of-Types http://sbcl.org/manual/index.html#Handling-of-Types
Eiffel had promoted Design by Contract for a long time.
> Cisco built their cybersecurity platform using Clojure.
Cisco uses a lot of software. Your Clojure marketing attempts are getting silly.