diff options
author | Derek <derrreks@gmail.com> | 2016-11-30 15:36:56 -0500 |
---|---|---|
committer | Samantha McVey <samantham@posteo.net> | 2016-11-30 12:36:56 -0800 |
commit | 51ce7fda40f3c951b807971587374c56fa9d7916 (patch) | |
tree | 2512e0f57cfc3ae0a775255141853b84c8173d5b /racket.html.markdown | |
parent | d0918b2576abcefcfca1f439e3b03511f1be0b89 (diff) |
[racket/en] Expand list section (#2588)
* Expand list section
* Update backtick
Diffstat (limited to 'racket.html.markdown')
-rw-r--r-- | racket.html.markdown | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/racket.html.markdown b/racket.html.markdown index 96dcaf25..38335bc1 100644 --- a/racket.html.markdown +++ b/racket.html.markdown @@ -164,10 +164,17 @@ my-pet ; => #<dog> (cons 1 (cons 2 (cons 3 null))) ; => '(1 2 3) ;; `list' is a convenience variadic constructor for lists (list 1 2 3) ; => '(1 2 3) -;; and a quote can also be used for a literal list value +;; a quote can also be used for a literal list value '(1 2 3) ; => '(1 2 3) +;; a quasiquote (represented by the backtick character) with commas +;; can be used to evaluate functions +`(1 ,(+ 1 1) 3) ; => '(1 2 3) -;; Racket has predefined functions on top of car and cdr, to extract parts of a list +;; With lists, car/cdr work slightly differently +(car '(1 2 3)) ; => 1 +(cdr '(1 2 3)) ; => '(2 3) + +;; Racket also has predefined functions on top of car and cdr, to extract parts of a list (cadr (list 1 2 3)) ; => 2 (car (cdr (list 1 2 3))) ; => 2 |