File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -606,6 +606,33 @@ According to Common Lisp HyperSpec:
606606* `fdefinition` takes either a *symbol* or a `(setf symbol)` form that
607607 designates a *function name*
608608
609+ === `typecase` vs. `etypecase` vs. `ctypecase`
610+
611+ Match type → perform action.
612+
613+ * `typecase`: if no match → returns `nil`.
614+ * `ctypecase`: if no match → returns a _correctable error_.
615+ * `etypecase`: if no match → returns a _non-correctable error_.
616+
617+ Examples:
618+
619+ [source,lisp,linenums]
620+ ----
621+ (typecase "a" (string :string)) ; ⇨ :string
622+ (typecase 1 (string :string)) ; ⇨ nil
623+
624+ (let ((x 1))
625+ (ctypecase x
626+ (string :string)
627+ (symbol (symbol-value x)))) ; ⇨ Asks to store value for X or abort
628+
629+ (let ((x 1))
630+ (etypecase x
631+ (string :string)
632+ (symbol (symbol-value x)))) ; ⇨ Error, cannot be corrected
633+ ----
634+
635+
609636== Useful libraries
610637
611638* Pathnames and operating system interfaces: http://weitz.de/cl-fad[cl-pad],
You can’t perform that action at this time.
0 commit comments