summaryrefslogtreecommitdiffhomepage
path: root/racket.html.markdown
diff options
context:
space:
mode:
authorEli Barzilay <eli@barzilay.org>2013-07-16 01:36:52 -0400
committerEli Barzilay <eli@barzilay.org>2013-07-16 01:36:52 -0400
commit3715c5c2b7523cb0f03ed927f9d42644b50ebf11 (patch)
tree8725243a7dd911c4fbd943cca429e7121f38945e /racket.html.markdown
parentd8989c2ae3d685b15c16491e30ae8d40580ed059 (diff)
C-escapes example.
Also, remove old-style "~n"s.
Diffstat (limited to 'racket.html.markdown')
-rw-r--r--racket.html.markdown11
1 files changed, 6 insertions, 5 deletions
diff --git a/racket.html.markdown b/racket.html.markdown
index 526d008c..015467d9 100644
--- a/racket.html.markdown
+++ b/racket.html.markdown
@@ -70,7 +70,8 @@ Feedback is appreciated! You can reach me at [@th3rac25](http://twitter.com/th3r
;;; Strings are fixed-length array of characters.
"Hello, world!"
-"Benjamin \"Bugsy\" Siegel" ; backslash is an escaping character
+"Benjamin \"Bugsy\" Siegel" ; backslash is an escaping character
+"Foo\tbar\41\x21\u0021\a\r\n" ; includes C escapes, Unicode
"λx:(μα.α→α).xx" ; any Unicode character can appear in a string constant
;; Strings can be added too!
@@ -282,7 +283,7 @@ m ; => '#hash((b . 2) (a . 1) (c . 3))
;; looping can be done through recursion
(define (loop i)
(when (< i 10)
- (printf "i:~a~n" i)
+ (printf "i:~a\n" i)
(loop (add1 i))))
(loop 5) ; => i:5 i:6 ...
@@ -290,7 +291,7 @@ m ; => '#hash((b . 2) (a . 1) (c . 3))
;; similarly, with a named let
(let loop ((i 0))
(when (< i 10)
- (printf "i:~a~n" i)
+ (printf "i:~a\n" i)
(loop (add1 i)))) ; => i:0 i:1 ...
;;; Comprehensions
@@ -325,7 +326,7 @@ m ; => '#hash((b . 2) (a . 1) (c . 3))
(displayln i))
(for ([(k v) (in-hash (hash 'a 1 'b 2 'c 3 ))])
- (printf "key:~a value:~a ~n" k v))
+ (printf "key:~a value:~a\n" k v))
;;; Exceptions
@@ -431,7 +432,7 @@ vec ; => #(1 2 3 4)
(define a 2)
(define b 3)
(swap a b)
-(printf "tmp = ~a; a = ~a; b = ~a~n" tmp a b) ; tmp is unaffected by swap
+(printf "tmp = ~a; a = ~a; b = ~a\n" tmp a b) ; tmp is unaffected by swap
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 10. Contracts