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
(defn maven-pod* [version] | |
(pod/make-pod (update-in (boot/get-env) | |
[:dependencies] | |
conj ['org.apache.maven/maven-embedder version :scope "test"]))) | |
(def maven-pod (memoize maven-pod*)) | |
(deftask mvn | |
"Run Maven commands from Boot" | |
[A args ARGS str "Maven commands and options" |
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
(defn mvn | |
"Run Maven commands from Leiningen." | |
[_project & args] | |
(let [mvn (new MavenCli)] | |
(.doMain mvn (into-array String args) "." System/out System/err))) |
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
boot repl --server --bind 0.0.0.0 --port 12345 wait |
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
(apply str (interpose \space ["Clojure" "is" "awesome"])) |
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
public void reduce(Text key, Iterator<IntWritable> values, | |
OutputCollector<Text, IntWritable> output, | |
Reporter reporter) throws IOException { | |
int min = Integer.MAX_VALUE; | |
while (values.hasNext()) { | |
int current = values.next().get(); | |
if(current < min){ | |
current = min; | |
} |
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
(reduce min [4 2 1 5 3]) |
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
(mapcat #(repeat % %) [1 2 3 4 5]) | |
;=> (1 2 2 3 3 3 4 4 4 4 5 5 5 5 5) |
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
(apply concat (map #(repeat % %) [1 2 3 4 5])) |
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
public void map(Text key, IntWritable value, | |
OutputCollector<Text, IntWritable> output, | |
Reporter reporter) | |
throws IOException { | |
for(int i = 0; i < value.get(); i++){ | |
output.collect(key, value); | |
} | |
} |
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
(filter #(> % 3) [1 2 3 4 5]) | |
;=> (4 5) |