In contrast to normal hooks, filter hooks are used mainly for getting their return values, i.e. the filter results, which are usually true or false. You may also utilize side effects in functions registered under filter hooks, but that's not always reliable, since filter hooks can get short circuited, and some of its functions may not always get executed.

There are again two types of filter hooks: the and hooks and the or hooks. Just as their names suggest, they work like and and or functions respectively.

And hooks call their registered functions consecutively, until one of them returns false, or until all the functions are called.

To define and call a custom and filter hook:

(def result
  (:call-filter-hook (in self :hook-manager) :and :filter-habitable-planet
                     galaxy system planet))

We have :filter-habitable-planet as the name of our new hook, and galaxy, system, planet will be passed to its registered functions as arguments.

Similarly, or hooks call their registered functions consecutively, until one of them returns true, or until all the functions are called.

To define and call a custom or filter hook:

(def result
  (:call-filter-hook (in self :hook-manager) :or :filter-forbidden-planet
                     galaxy system planet))