Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created June 20, 2013 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swannodette/5824533 to your computer and use it in GitHub Desktop.
Save swannodette/5824533 to your computer and use it in GitHub Desktop.
(match [x1 y1 x2 y2]
[1 1 1 1] 1
[1 1 1 0] 0
[1 1 0 1] 0
[1 1 0 0] 1
[1 0 _ _] 0
[0 1 _ _] 0
[0 0 1 1] 1
[0 0 1 0] 0
[0 0 0 1] 0
[0 0 0 0] 1)
;; produces >>
(cond
(= x1 1) (cond
(= y1 1) (cond
(= x2 1) (cond
(= y2 1) 1
(= y2 0) 0)
(= x2 0) (cond
(= y2 1) 0
(= y2 0) 1))
(= y1 0) 0)
(= x1 0) (cond
(= y1 1) 0
(= y1 0) (cond
(= x2 1) (cond
(= y2 1) 1
(= y2 0) 0)
(= x2 0) (cond
(= y2 1) 0
(= y2 0) 1))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment