mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-30 01:50:25 +02:00
Indentation fixes.
This commit is contained in:
@@ -250,18 +250,18 @@ 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
|
||||||
|
|
||||||
@@ -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)
|
||||||
|
Reference in New Issue
Block a user