Skip to content

Instantly share code, notes, and snippets.

@viebel
Forked from alandipert/reinvoke.cljs
Last active June 10, 2016 07:51
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 viebel/8461313 to your computer and use it in GitHub Desktop.
Save viebel/8461313 to your computer and use it in GitHub Desktop.
Make a regex behave like a function
; Make a regex behave like a function
; Inspired by: http://blog.klipse.tech/clojure/2016/04/07/ifn.html
(extend-type js/RegExp
IFn
(-invoke ([this s] (re-find this s))))
(#"clojure" "clojurescript")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment