Skip to content

Instantly share code, notes, and snippets.

@bowbow99
Created February 20, 2014 14:18
Show Gist options
  • Save bowbow99/9114585 to your computer and use it in GitHub Desktop.
Save bowbow99/9114585 to your computer and use it in GitHub Desktop.
#xyzzy cons の CAR-TYPE/CDR-TYPE を再帰的に指定する typespec で plist
(deftype plist (&optional key-type value-type)
(let* ((tail (list value-type nil))
(spec `(or null
(cons ,key-type
(cons ,@tail)))))
(setf (cadr tail) spec)
spec))
(si:canonicalize-type '(plist keyword number))
=> #1=(or null (cons keyword (cons number #1#)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment