Skip to content

Instantly share code, notes, and snippets.

@dpurjon
Created December 22, 2017 20:56
Show Gist options
  • Select an option

  • Save dpurjon/215362746e6c99bcf9a25b3fb6c983df to your computer and use it in GitHub Desktop.

Select an option

Save dpurjon/215362746e6c99bcf9a25b3fb6c983df to your computer and use it in GitHub Desktop.
Edge detector
(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