mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-26 15:13:56 +00:00
[racket/en] fix indentation and spacing (#4251)
* Fix indentation and spacing * One more fix
This commit is contained in:
parent
1670518461
commit
ed198750d4
@ -413,7 +413,7 @@ m ; => '#hash((b . 2) (a . 1) (c . 3)) <-- no `d'
|
||||
(loop 5) ; => i=5, i=6, ...
|
||||
|
||||
;; Similarly, with a named let
|
||||
(let loop ((i 0))
|
||||
(let loop ([i 0])
|
||||
(when (< i 10)
|
||||
(printf "i=~a\n" i)
|
||||
(loop (add1 i)))) ; => i=0, i=1, ...
|
||||
@ -447,11 +447,13 @@ m ; => '#hash((b . 2) (a . 1) (c . 3)) <-- no `d'
|
||||
;;; More Complex Iterations
|
||||
|
||||
;; Parallel scan of multiple sequences (stops on shortest)
|
||||
(for ([i 10] [j '(x y z)]) (printf "~a:~a\n" i j))
|
||||
(for ([i 10] [j '(x y z)])
|
||||
(printf "~a:~a\n" i j))
|
||||
; => 0:x 1:y 2:z
|
||||
|
||||
;; Nested loops
|
||||
(for* ([i 2] [j '(x y z)]) (printf "~a:~a\n" i j))
|
||||
(for* ([i 2] [j '(x y z)])
|
||||
(printf "~a:~a\n" i j))
|
||||
; => 0:x, 0:y, 0:z, 1:x, 1:y, 1:z
|
||||
|
||||
;; Conditions
|
||||
@ -663,8 +665,7 @@ vec ; => #(1 2 3 4)
|
||||
|
||||
(define amount 0)
|
||||
(define (deposit a) (set! amount (+ amount a)))
|
||||
(define (balance) amount)
|
||||
)
|
||||
(define (balance) amount))
|
||||
|
||||
(require 'bank-account)
|
||||
(deposit 5)
|
||||
|
Loading…
Reference in New Issue
Block a user