8.16.0.2
1.3 Uncallable Functions
(require rebellion/base/impossible-function) | |
package: rebellion |
procedure
(impossible v) → any/c
v : none/c
The impossible function. Calling impossible with any input always
raises an error, because it is impossible for v to satisfy the
none/c contract.
Example:
> (impossible 42) impossible: contract violation;
none/c allows no values
given: 42
in: the 1st argument of
(-> none/c any/c)
contract from:
<pkgs>/rebellion/base/impossible-function.rkt
blaming: top-level
(assuming the contract is correct)
at: <pkgs>/rebellion/base/impossible-function.rkt:7:3
This function is useful as an argument to higher-order functions where you know the function will not be called. For example, mapping the impossible function over an empty list will succeed without error:
Example:
> (map impossible empty-list) '()