From fe1f96b8c0d8008f2ab08ca47d8da820afe2d931 Mon Sep 17 00:00:00 2001 From: Colin Jones Date: Fri, 29 Oct 2010 10:07:11 -0500 Subject: [PATCH] Upgrade to Clojure 1.3.0-alpha1. --- README.md | 12 +++++++----- project.clj | 3 +-- repl.bat | 2 +- repl.sh | 2 +- run.bat | 2 +- run.sh | 2 +- src/koans/functions.clj | 10 +++++----- src/path_to_answer_sheet.clj | 6 +++--- src/path_to_enlightenment.clj | 3 ++- test.bat | 2 +- test.sh | 2 +- 11 files changed, 24 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 880baae..d98f95f 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,13 @@ The only things you need to run the Clojure Koans are: - JRE 1.5 or higher -- clojure-1.2.0.jar +- clojure-1.3.0-alpha1.jar -clojure-1.2.0.jar needs to be placed in a directory `lib` under this project. +clojure-1.3.0-alpha1.jar needs to be placed in a directory `lib` under this +project. -You can use leiningen (http://github.com/technomancy/leiningen) to -automatically install the clojure-1.2.0.jar in the right place. +You can use Leiningen (http://github.com/technomancy/leiningen) to +automatically install the Clojure jar in the right place. After you have leiningen installed, run @@ -24,8 +25,9 @@ which will download all dependencies you need to run the clojure koans. To run the koans, simply run -`./run.sh` +`run.sh` or, on Windows, `run.bat` + diff --git a/project.clj b/project.clj index 7a0b20f..632026e 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,3 @@ (defproject functional-koans "0.1.0" :description "The functional koans" - :dependencies [[org.clojure/clojure "1.2.0"]] - :namespaces [koans]) + :dependencies [[org.clojure/clojure "1.3.0-alpha1"]]) diff --git a/repl.bat b/repl.bat index 36778ee..2964cfc 100755 --- a/repl.bat +++ b/repl.bat @@ -1,2 +1,2 @@ @echo off -java -jar lib\clojure-1.2.0.jar +java -jar lib\clojure-1.3.0-alpha1.jar diff --git a/repl.sh b/repl.sh index a57fa83..4f49c82 100755 --- a/repl.sh +++ b/repl.sh @@ -1,2 +1,2 @@ -java -jar lib/clojure-1.2.0.jar +java -jar lib/clojure-1.3.0-alpha1.jar echo diff --git a/run.bat b/run.bat index 8996358..6c884c6 100755 --- a/run.bat +++ b/run.bat @@ -1,2 +1,2 @@ @echo off -java -cp lib\clojure-1.2.0.jar;src clojure.main -e "(load \"path_to_enlightenment\")" -e "(do (in-ns 'path-to-enlightenment) (run))" +java -cp lib\clojure-1.3.0-alpha1.jar;src clojure.main -e "(load \"path_to_enlightenment\")" -e "(do (in-ns 'path-to-enlightenment) (run))" diff --git a/run.sh b/run.sh index f59164c..c3036c8 100755 --- a/run.sh +++ b/run.sh @@ -1,2 +1,2 @@ -java -cp lib/clojure-1.2.0.jar:src clojure.main -e '(load "path_to_enlightenment")' -e "(do (in-ns 'path-to-enlightenment) (run))" +java -cp lib/clojure-1.3.0-alpha1.jar:src clojure.main -e '(load "path_to_enlightenment")' -e "(do (in-ns 'path-to-enlightenment) (run))" echo diff --git a/src/koans/functions.clj b/src/koans/functions.clj index 3e6700b..28ca1f8 100644 --- a/src/koans/functions.clj +++ b/src/koans/functions.clj @@ -1,15 +1,15 @@ -(defn raise-to-the-tenth-power [n] - (Math/pow n 10)) +(defn multiply-by-ten [n] + (* 10 n)) (meditations "Functions are often defined before they are used" - (= __ (raise-to-the-tenth-power 2)) + (= __ (multiply-by-ten 2)) "But they can also be defined inline" - (= __ ((fn [n] (Math/pow n __)) 2)) + (= __ ((fn [n] (* __ n)) 2)) "Or using even shorter syntax" - (= __ (#(Math/pow % 10) __)) + (= __ (#(* 15 %) __)) "One function can beget another" (= __ ((fn [] diff --git a/src/path_to_answer_sheet.clj b/src/path_to_answer_sheet.clj index 3ff807b..3028fdc 100644 --- a/src/path_to_answer_sheet.clj +++ b/src/path_to_answer_sheet.clj @@ -47,9 +47,9 @@ 1 "\"January\"" 2006 2010 2014 "\"Vancouver\""]} - "functions" {"__" [1024 - 32 5 - 1024 2 + "functions" {"__" [20 + 10 5 + 30 2 20 "*"] "___" ["(fn [f] (f 5))"]} "conditionals" {"__" [:a diff --git a/src/path_to_enlightenment.clj b/src/path_to_enlightenment.clj index 9dd3531..3d65865 100644 --- a/src/path_to_enlightenment.clj +++ b/src/path_to_enlightenment.clj @@ -1,5 +1,6 @@ (ns path-to-enlightenment - (:use clojure.test)) + (:use [clojure.test]) + (:require [clojure.set])) (def __ nil) (def ___ (fn [& args] nil)) diff --git a/test.bat b/test.bat index a22ca46..f15ba8f 100755 --- a/test.bat +++ b/test.bat @@ -1,2 +1,2 @@ @echo off -java -cp lib\clojure-1.2.0.jar;src clojure.main -e "(load \"path_to_answer_sheet\")" -e "(do (in-ns 'path-to-answer-sheet) (run))" +java -cp lib\clojure-1.3.0-alpha1.jar;src clojure.main -e "(load \"path_to_answer_sheet\")" -e "(do (in-ns 'path-to-answer-sheet) (run))" diff --git a/test.sh b/test.sh index dd30a4c..c387cd3 100755 --- a/test.sh +++ b/test.sh @@ -1,2 +1,2 @@ -java -cp lib/clojure-1.2.0.jar:src clojure.main -e '(load "path_to_answer_sheet")' -e "(do (in-ns 'path-to-answer-sheet) (run))" +java -cp lib/clojure-1.3.0-alpha1.jar:src clojure.main -e '(load "path_to_answer_sheet")' -e "(do (in-ns 'path-to-answer-sheet) (run))" echo