From 6430a79c4f0a992de5f8b796a958f9f5f4ba6e6b Mon Sep 17 00:00:00 2001 From: Damian Niemczyk Date: Mon, 25 Jan 2016 21:18:50 +0100 Subject: [PATCH 1/2] Update clojure version --- README.md | 4 ++-- project.clj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a7da7af..3d0f37c 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ exercises you've already completed. The only things you'll need to run the Clojure Koans are: -- JRE 1.5 or higher -- [clojure-1.5.1.jar](http://repo1.maven.org/maven2/org/clojure/clojure/1.5.1/clojure-1.5.1.zip) +- JRE 1.6 or higher +- [clojure-1.8.0.jar](http://repo1.maven.org/maven2/org/clojure/clojure/1.8.0/clojure-1.8.0.zip) You can use [Leiningen](http://github.com/technomancy/leiningen) to automatically install the Clojure jar in the right place. Leiningen will also diff --git a/project.clj b/project.clj index 9aca071..3edd040 100644 --- a/project.clj +++ b/project.clj @@ -1,6 +1,6 @@ (defproject clojure-koans "0.5.1-SNAPSHOT" :description "The Clojure koans." - :dependencies [[org.clojure/clojure "1.7.0"] + :dependencies [[org.clojure/clojure "1.8.0"] [koan-engine "0.2.3"]] :dev-dependencies [[lein-koan "0.1.3"]] :profiles {:dev {:dependencies [[lein-koan "0.1.3"]]}} From 4b8c21ee3474a6810d203040e87b16cefc56b4b8 Mon Sep 17 00:00:00 2001 From: Damian Niemczyk Date: Mon, 25 Jan 2016 21:30:57 +0100 Subject: [PATCH 2/2] Update java string methods to clojure functions With Clojure 1.8.0 finaly those string methods now have correspondig clojure functions. Of note here is, that the clojure.string/index-of function responds with nil if nothing is found and not -1 as .IndexOf previously did. --- resources/koans.clj | 2 +- src/koans/02_strings.clj | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/koans.clj b/resources/koans.clj index b73f9fc..1ae5b97 100644 --- a/resources/koans.clj +++ b/resources/koans.clj @@ -24,7 +24,7 @@ "olleh" "hello" 13 - -1 + nil "hello world" true false diff --git a/src/koans/02_strings.clj b/src/koans/02_strings.clj index 92f4817..af4e555 100644 --- a/src/koans/02_strings.clj +++ b/src/koans/02_strings.clj @@ -37,13 +37,13 @@ (= __ (string/reverse "hello")) "Maybe you want to find the index of the first occurence of a substring" - (= 0 (.indexOf "hello world" __)) + (= 0 (string/index-of "hello world" __)) "Or maybe the last index of the same" - (= __ (.lastIndexOf "hello world, hello" "hello")) + (= __ (string/last-index-of "hello world, hello" "hello")) - "But when something doesn't exist, it turns up negative" - (= __ (.indexOf "hello world" "bob")) + "But when something doesn't exist, nothing is found" + (= __ (string/index-of "hello world" "bob")) "Sometimes you don't want whitespace cluttering the front and back" (= __ (string/trim " \nhello world \t \n"))