From 51ce7fda40f3c951b807971587374c56fa9d7916 Mon Sep 17 00:00:00 2001 From: Derek Date: Wed, 30 Nov 2016 15:36:56 -0500 Subject: [racket/en] Expand list section (#2588) * Expand list section * Update backtick --- racket.html.markdown | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'racket.html.markdown') 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 ; => # (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 -- cgit v1.2.3