From 6c00a3e358adf0af6aa773ec249f9ec16ff2e0ba Mon Sep 17 00:00:00 2001 From: Colin Jones Date: Thu, 12 May 2016 10:41:09 -0500 Subject: [PATCH] Improve some of the quote descriptions --- ideaboard.txt | 2 -- resources/koans.clj | 3 ++- src/koans/24_quote.clj | 21 ++++++++++----------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ideaboard.txt b/ideaboard.txt index 8166a99..31dc55b 100644 --- a/ideaboard.txt +++ b/ideaboard.txt @@ -1,8 +1,6 @@ Concepts / Language Features ===== -Quoting - new record syntax Agents Vars diff --git a/resources/koans.clj b/resources/koans.clj index e48d3b8..a1b467d 100644 --- a/resources/koans.clj +++ b/resources/koans.clj @@ -8,6 +8,7 @@ false "hello" "hello" + nil 3]}] ["02_strings" {"__" ["hello" @@ -253,7 +254,7 @@ :park "AT&T Park" 'Giants "Giants"]}] - ["24_quote" {"__"[(1 2 3 4 5) + ["24_quote" {"__" ['(1 2 3 4 5) (1 2 3 4 5) 'age quote diff --git a/src/koans/24_quote.clj b/src/koans/24_quote.clj index 8741b51..f36298a 100644 --- a/src/koans/24_quote.clj +++ b/src/koans/24_quote.clj @@ -3,24 +3,23 @@ (meditations - "use quote to express a list" - (= (quote __) (list 1 2 3 4 5)) + "Wrap a quote around a list to suppress evaluation" + (= (quote (1 2 3 4 5)) __) - "Clojure provide a shotcut" - (= (quote __) '(1 2 3 4 5)) - - "The quote special operator prevents its argument from being evaluated at all" + "There is a shortcut too!" + (= (quote __) '(1 2 3 4 5)) + + "You can quote symbols as well as lists... without evaluation!" (= __ (let [age 9] (quote age))) "You can use a literal list as a data collection without having Clojure try to call a function" (= (cons 1 (__ (2 3))) (list 1 2 3) (cons 1 [2 3])) - "Th quote affects all of its argument, not just the top level" + "The quote affects all of its arguments, not just the top level" (= (list 1 __) '(1 (+ 2 3))) - "Syntax-quote has a few extra features that make it ideal for constructing collections to be used as code." + "Syntax-quote (`) acts similarly to the normal quote" (= (list __ __ __) `(1 2 3) '(1 2 3)) - "Unquote is used to demarcate specific forms as requiring evaluation by prefixing fhem with the symbol ~ within the body of a syntax-quote" - (= (list __ __) `(1 ~(+ 2 3)) '(1 5)) - ) + "Unquote (~) within a syntax-quoted expression lets you mark specific expressions as requiring evaluation" + (= (list __ __) `(1 ~(+ 2 3)) '(1 5)))