Created
December 22, 2017 20:56
-
-
Save dpurjon/215362746e6c99bcf9a25b3fb6c983df to your computer and use it in GitHub Desktop.
Edge detector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn one [[x & xs]] | |
| (when x | |
| (if (zero? x) | |
| (cons 1 (zero xs)) | |
| (cons 0 (one xs))))) | |
| (defn zero [[x & xs]] | |
| (when x | |
| (if (zero? x) | |
| (cons 0 (zero xs)) | |
| (cons 1 (one xs))))) | |
| (defn f [[x & xs]] | |
| (when x | |
| (cons 0 (if (zero? x) (zero xs) (one xs))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment