Improve some of the quote descriptions

This commit is contained in:
Colin Jones 2016-05-12 10:41:09 -05:00
parent bfeaa7cf07
commit 6c00a3e358
No known key found for this signature in database
GPG Key ID: 558A6B658C368953
3 changed files with 12 additions and 14 deletions

View File

@ -1,8 +1,6 @@
Concepts / Language Features Concepts / Language Features
===== =====
Quoting
new record syntax new record syntax
Agents Agents
Vars Vars

View File

@ -8,6 +8,7 @@
false false
"hello" "hello"
"hello" "hello"
nil
3]}] 3]}]
["02_strings" {"__" ["hello" ["02_strings" {"__" ["hello"
@ -253,7 +254,7 @@
:park "AT&T Park" :park "AT&T Park"
'Giants 'Giants
"Giants"]}] "Giants"]}]
["24_quote" {"__"[(1 2 3 4 5) ["24_quote" {"__" ['(1 2 3 4 5)
(1 2 3 4 5) (1 2 3 4 5)
'age 'age
quote quote

View File

@ -3,24 +3,23 @@
(meditations (meditations
"use quote to express a list" "Wrap a quote around a list to suppress evaluation"
(= (quote __) (list 1 2 3 4 5)) (= (quote (1 2 3 4 5)) __)
"Clojure provide a shotcut" "There is a shortcut too!"
(= (quote __) '(1 2 3 4 5)) (= (quote __) '(1 2 3 4 5))
"The quote special operator prevents its argument from being evaluated at all" "You can quote symbols as well as lists... without evaluation!"
(= __ (let [age 9] (quote age))) (= __ (let [age 9] (quote age)))
"You can use a literal list as a data collection without having Clojure try to call a function" "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])) (= (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))) (= (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)) (= (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" "Unquote (~) within a syntax-quoted expression lets you mark specific expressions as requiring evaluation"
(= (list __ __) `(1 ~(+ 2 3)) '(1 5)) (= (list __ __) `(1 ~(+ 2 3)) '(1 5)))
)