-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
getting closer to something that, you know, works
- Loading branch information
1 parent
5cb26ae
commit 7c48c76
Showing
7 changed files
with
234 additions
and
48 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# put your stuff here to run the tests | ||
|
||
##wordnik.api.key= | ||
##wordnik.username= | ||
##wordnik.password= | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(ns wordnik.util | ||
(:use [clojure.contrib.str-utils2 :as s :only [split capitalize map-str]])) | ||
|
||
;; from stack overflow: http://bit.ly/qnogIl | ||
(defn seq-contains? | ||
"Determine whether a sequence contains a given item" | ||
[sequence item] | ||
(if (empty? sequence) | ||
false | ||
(reduce #(or %1 %2) (map #(= %1 item) sequence)))) | ||
|
||
(defn- local-join | ||
[parts] | ||
(let [f (first parts) | ||
n (next parts)] | ||
(str f (s/map-str s/capitalize n)))) | ||
|
||
(defn lisp-to-camel | ||
"Takes a Lisp style variable name and returns a camel case version, first | ||
character lower, i.e. doof-cha-what-now becomse doofChaWhatNow" | ||
[var-name] | ||
(let [pattern (re-pattern "\\-") | ||
parts (s/split (name var-name) pattern) | ||
is-keyword? (keyword var-name)] | ||
(if (keyword? var-name) | ||
(keyword (local-join parts)) | ||
(local-join parts)))) | ||
|
Oops, something went wrong.