mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Indentation fixes.
This commit is contained in:
parent
fa1ef10edd
commit
6b282360b0
@ -250,18 +250,18 @@ m ; => '#hash((b . 2) (a . 1) (c . 3))
|
||||
|
||||
(if #t ; test expression
|
||||
"this is true" ; then expression
|
||||
"this is false" ; else expression
|
||||
) ; => "this is true"
|
||||
"this is false") ; else expression
|
||||
; => "this is true"
|
||||
|
||||
;; In conditionals, all non-#f values are treated as true
|
||||
(member "Groucho" '("Harpo" "Groucho" "Zeppo")) ; => '("Groucho" "Zeppo")
|
||||
(if (member "Groucho" '("Harpo" "Groucho" "Zeppo"))
|
||||
'yep
|
||||
'nope) ; => 'yep
|
||||
'nope)
|
||||
; => 'yep
|
||||
|
||||
;; "cond" chains a series of tests to select a result
|
||||
(cond
|
||||
[(> 2 2) (error "wrong!")]
|
||||
(cond [(> 2 2) (error "wrong!")]
|
||||
[(< 2 2) (error "wrong again!")]
|
||||
[else 'ok]) ; => 'ok
|
||||
|
||||
@ -448,7 +448,7 @@ vec ; => #(1 2 3 4)
|
||||
(define amount 0)
|
||||
(define (deposit a) (set! amount (+ amount a)))
|
||||
(define (balance) amount)
|
||||
)
|
||||
)
|
||||
|
||||
(require 'bank-account)
|
||||
(deposit 5)
|
||||
|
Loading…
Reference in New Issue
Block a user