Skip to content

Instantly share code, notes, and snippets.

@mmower
Created September 16, 2012 14:37
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 mmower/7529c04e8836fe88b4d8 to your computer and use it in GitHub Desktop.
Save mmower/7529c04e8836fe88b4d8 to your computer and use it in GitHub Desktop.
(def prefix-of? (fn [candidate sequence] (reduce #(and %1 %2) (map = candidate sequence))))
user=> (prefix-of? [1 2] [1 2 3 4])
true
user=> (prefix-of? [2 2] [1 2 3 4])
false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment