Indentation fixes.

This commit is contained in:
Eli Barzilay 2013-07-16 01:28:20 -04:00
parent fa1ef10edd
commit 6b282360b0

View File

@ -102,8 +102,8 @@ some-var ; => 5
;; Local binding: me is bound to "Bob" only within (let ...) ;; Local binding: me is bound to "Bob" only within (let ...)
(let ([me "Bob"]) (let ([me "Bob"])
"Alice" "Alice"
me) ; => "Bob" me) ; => "Bob"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 3. Structs and Collections ;; 3. Structs and Collections
@ -250,20 +250,20 @@ m ; => '#hash((b . 2) (a . 1) (c . 3))
(if #t ; test expression (if #t ; test expression
"this is true" ; then expression "this is true" ; then expression
"this is false" ; else expression "this is false") ; else expression
) ; => "this is true" ; => "this is true"
;; In conditionals, all non-#f values are treated as true ;; In conditionals, all non-#f values are treated as true
(member "Groucho" '("Harpo" "Groucho" "Zeppo")) ; => '("Groucho" "Zeppo") (member "Groucho" '("Harpo" "Groucho" "Zeppo")) ; => '("Groucho" "Zeppo")
(if (member "Groucho" '("Harpo" "Groucho" "Zeppo")) (if (member "Groucho" '("Harpo" "Groucho" "Zeppo"))
'yep 'yep
'nope) ; => 'yep 'nope)
; => 'yep
;; "cond" chains a series of tests to select a result ;; "cond" chains a series of tests to select a result
(cond (cond [(> 2 2) (error "wrong!")]
[(> 2 2) (error "wrong!")] [(< 2 2) (error "wrong again!")]
[(< 2 2) (error "wrong again!")] [else 'ok]) ; => 'ok
[else 'ok]) ; => 'ok
;;; Pattern Matching ;;; Pattern Matching
@ -296,13 +296,13 @@ m ; => '#hash((b . 2) (a . 1) (c . 3))
;;; Comprehensions ;;; Comprehensions
(for/list ([i '(1 2 3)]) (for/list ([i '(1 2 3)])
(add1 i)) ; => '(2 3 4) (add1 i)) ; => '(2 3 4)
(for/list ([i '(1 2 3)] #:when (even? i)) (for/list ([i '(1 2 3)] #:when (even? i))
i) ; => '(2) i) ; => '(2)
(for/hash ([i '(1 2 3)]) (for/hash ([i '(1 2 3)])
(values i (number->string i))) ; => '#hash((1 . "1") (2 . "2") (3 . "3")) (values i (number->string i))) ; => '#hash((1 . "1") (2 . "2") (3 . "3"))
;; To combine iteration results, use "for/fold" ;; To combine iteration results, use "for/fold"
(for/fold ([sum 0]) ([i '(1 2 3 4)]) (for/fold ([sum 0]) ([i '(1 2 3 4)])
@ -448,7 +448,7 @@ vec ; => #(1 2 3 4)
(define amount 0) (define amount 0)
(define (deposit a) (set! amount (+ amount a))) (define (deposit a) (set! amount (+ amount a)))
(define (balance) amount) (define (balance) amount)
) )
(require 'bank-account) (require 'bank-account)
(deposit 5) (deposit 5)