Skip to content
marick edited this page Mar 23, 2011 · 1 revision

Suppose you're writing a program that produces animals and you have a bird? predicate. You might want to note facts like these:

   (facts "about bird construction"
     (make "penguin") => bird?
     (make "cormorant") => bird?
     ...)

That's fine, but what if you want to describe how the program can also produce animals that are not birds? Here are two awkward ways to do that:

   (facts "about marsupial construction"
     (make "sugar glider") => (complement bird?)
     (bird? (make "koala")) => falsey
     ...)

I think those are ugly, especially when you mix the two types of facts. Therefore, you can write this instead:

   (facts "about what kinds of animals are birds"
     (make "penguin")          => bird?
     (make "cormorant")        => bird?
     (make "sugar glider") =not=> bird?
     (make "koala")        =not=> bird?

English Literature majors like me will appreciate that they can use =deny=> as a synonym for =not=>. Sometimes =deny=> reads better.

These arrow-forms don't require that the right-hand side be a function. You can use them on specific values:

       (fact (f 2) =not=> 2)
Clone this wiki locally