diff options
-rw-r--r-- | README.org | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/README.org b/README.org new file mode 100644 index 0000000..efd1ad6 --- /dev/null +++ b/README.org @@ -0,0 +1,40 @@ +* `petty-types` + +#+begin_src lisp + +> (typep (list 1 2 3 4) '(list-of real)) +T +> (typep (list 1 2 3 4 3 2 1) '(list-of real)) +T +> (typep (list 1 2 3 4) '(list-of real 4)) +T +> (typep (list 1 2 #C(0 1)) '(list-of real)) +NIL +> (typep (list 1 2 3 4) '(list-of real 5)) +NIL +> (typep "aaabbb" '(vector-of (member #\a #\b))) +T +> (typep "aacabbb" '(vector-of (member #\a #\b))) +NIL +> (typep "aaabbb" '(vector-of (member #\a #\b) 6)) +T +> (typep "aaaabbb" '(vector-of (member #\a #\b) 6)) +NIL +> (typep "4aabbb" '(vector-of (member #\a #\b) 6)) +NIL +> (typep "aabbba" '(vector-of (member #\a #\b) 6)) +T + +;; THIS IS ESPECIALLY ANNOYING: +> (type-of "abab") +(SIMPLE-ARRAY CHARACTER (4)) +> (typep "abab" '(simple-array (member #\a #\b) (4))) +NIL + +;; but as above, VECTOR-OF works. +> (typep "abab" '(vector-of (member #\a #\b) 4)) +T + + + +#+end_src |