This file contains hidden or 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
(ns koans.03-vectors | |
(:require [koan-engine.core :refer :all])) | |
(meditations | |
"You can use vectors in clojure as array-like structures" | |
(= 1 (count [42])) | |
"You can create a vector from a list" | |
(= (list 1) (vec '(1))) |
This file contains hidden or 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
(ns koans.04-sets | |
(:require [koan-engine.core :refer :all])) | |
(meditations | |
"You can create a set by converting another collection" | |
(= #{3} (set '(3))) | |
"Counting them is like counting other collections" | |
(= 3 (count #{1 2 3})) |
This file contains hidden or 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
(ns koans.05-maps | |
(:require [koan-engine.core :refer :all])) | |
(meditations | |
"Don't get lost when creating a map" | |
(= {:a 1 :b 2} (hash-map :a 1 :b 2)) | |
"A value must be supplied for each key" | |
(= {:a 1} (hash-map :a 1)) |
This file contains hidden or 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
(ns koans.06-functions | |
(:require [koan-engine.core :refer :all])) | |
(defn multiply-by-ten [n] | |
(* 10 n)) | |
(defn square [n] (* n n)) | |
(meditations | |
"Calling a function is like giving it a hug with parentheses" |
This file contains hidden or 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
(ns koans.07-conditionals | |
(:require [koan-engine.core :refer :all])) | |
(defn explain-defcon-level [exercise-term] | |
(case exercise-term | |
:fade-out :you-and-what-army | |
:double-take :call-me-when-its-important | |
:round-house :o-rly | |
:fast-pace :thats-pretty-bad | |
:cocked-pistol :sirens |
This file contains hidden or 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
(ns koans.08-higher-order-functions | |
(:require [koan-engine.core :refer :all])) | |
(meditations | |
"The map function relates a sequence to another" | |
(= [4 8 12] (map (fn [x] (* 4 x)) [1 2 3])) | |
"You may create that mapping" | |
(= [1 4 9 16 25] (map (fn [x] (* x x)) [1 2 3 4 5])) |
This file contains hidden or 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
(ns koans.09-runtime-polymorphism | |
(:require [koan-engine.core :refer :all])) | |
(defn hello | |
([] "Hello World!") | |
([a] (str "Hello, you silly " a ".")) | |
([a & more] (str "Hello to this group: " | |
(apply str | |
(interpose ", " (concat (list a) more))) | |
"!"))) |
This file contains hidden or 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 + | |
(map | |
(fn [pair] (* (first pair) (second pair))) | |
(take 1000 | |
(partition 2 1 (filter odd? | |
(iterate inc 0)))))) |
This file contains hidden or 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 isPalindrome | |
[inputStr] | |
(= inputStr (apply str (reverse inputStr)))) |
This file contains hidden or 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
2014-10-30 13:34:56,682 ERROR api.LWEStatusService - | |
org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: String index out of range: 0 | |
at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:780) | |
at com.lucid.servlet.LweCoreContainer.checkProps(LweCoreContainer.java:84) | |
at com.lucid.servlet.LweCoreContainer.getCoreByCollection(LweCoreContainer.java:70) | |
at com.lucid.servlet.LweCoreContainer.getCore(LweCoreContainer.java:33) | |
at com.lucid.api.CollectionInfoServerResource.doInit(CollectionInfoServerResource.java:91) | |
at org.restlet.resource.Resource.init(Resource.java:706) | |
at org.restlet.resource.Finder.handle(Finder.java:243) | |
at org.restlet.routing.Filter.doHandle(Filter.java:159) |