Skip to content

Instantly share code, notes, and snippets.

@maxcountryman
Created March 8, 2014 19:15
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 maxcountryman/9437367 to your computer and use it in GitHub Desktop.
Save maxcountryman/9437367 to your computer and use it in GitHub Desktop.
;; Greater-Than and Less-Than comparator->bool helpers
(defn gt? [x y]
(case (compare x y)
1 true
0 false
-1 false))
(defn lt? [x y]
(case (compare x y)
1 false
0 false
-1 true))
@ztellman
Copy link

ztellman commented Mar 8, 2014

compare returns positive and negative values, not necessarily just 1 and -1.

> (compare "abc" "def")
-3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment