Skip to content

Type operations ​

Type-operations define arbitrary transformations between types.

emacs-lisp
(et (minus Boolean Nil))
;; -> True

This is fairly useless when using concrete types: you could have just written (et True). Type-operations become much more useful when applied to type-variables:

emacs-lisp
(et-defun my-remove-nil ([T] list: &List<T>) (List (minus T Nil))
  (remq list nil))

(my-remove-nil (:type List<Boolean>))
;; >> List<True>

We have already seen the narrowing operations is?, is-a?, and isnt?, as well as the freshening operations freshen-deep and freshen-shallow. A more complete list of type operations can be found here.
By convention, most type-operations and type-macros should be named in lowercase, while core datatypes and aliases are uppercase.