Skip to content

Instantly share code, notes, and snippets.

@missingfaktor
Created October 23, 2015 14:07
Show Gist options
  • Select an option

  • Save missingfaktor/dc7d5de59123e13d930f to your computer and use it in GitHub Desktop.

Select an option

Save missingfaktor/dc7d5de59123e13d930f to your computer and use it in GitHub Desktop.
user=> (defn foobar [xs]
#_=> (match xs (clauses !empty (fn [] :empty)
#_=> (!cons (!constant 3) !empty) (fn [] :singleton-with-3)
#_=> (!cons !var !any) (fn [head] head))))
#'user/foobar
user=> (foobar [])
:empty
user=> (foobar [3])
:singleton-with-3
user=> (foobar [3 9])
3
user=> (foobar [3 9 11])
3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment