fully rackety guide

original commit: 162058036ec2fcce1905fdf746b6faa3a0342d34
This commit is contained in:
Matthew Flatt 2010-04-30 07:39:41 -06:00
commit 7d91640d72
2 changed files with 22 additions and 16 deletions

View File

@ -7,7 +7,7 @@
racket/file racket/file
racket/sandbox racket/sandbox
racket/promise racket/promise
mzlib/string racket/string
(for-syntax racket/base)) (for-syntax racket/base))
(provide interaction (provide interaction
@ -97,18 +97,24 @@
(map (map
(lambda (s) (lambda (s)
(car (format-output s error-color))) (car (format-output s error-color)))
(let sloop ([s (caar val-list+outputs)]) (filter
(if ((string-length s) . > . maxlen) (lambda (s) (not (equal? s "")))
;; break the error message into multiple lines: (let sloop ([s (caar val-list+outputs)])
(let loop ([pos (sub1 maxlen)]) (apply
(cond append
[(zero? pos) (cons (substring s 0 maxlen) (map (lambda (s)
(sloop (substring s maxlen)))] (if ((string-length s) . > . maxlen)
[(char-whitespace? (string-ref s pos)) ;; break the error message into multiple lines:
(cons (substring s 0 pos) (let loop ([pos (sub1 maxlen)])
(sloop (substring s (add1 pos))))] (cond
[else (loop (sub1 pos))])) [(zero? pos) (cons (substring s 0 maxlen)
(list s)))) (sloop (substring s maxlen)))]
[(char-whitespace? (string-ref s pos))
(cons (substring s 0 pos)
(sloop (substring s (add1 pos))))]
[else (loop (sub1 pos))]))
(list s)))
(regexp-split #rx"\n" s))))))
;; Normal result case: ;; Normal result case:
(let ([val-list (caar val-list+outputs)]) (let ([val-list (caar val-list+outputs)])
(if (equal? val-list (list (void))) (if (equal? val-list (list (void)))

View File

@ -28,9 +28,9 @@ evaluator is created using @scheme[make-base-eval]. See also
Uses of @scheme[code:comment] and @schemeidfont{code:blank} are Uses of @scheme[code:comment] and @schemeidfont{code:blank} are
stipped from each @scheme[datum] before evaluation. stipped from each @scheme[datum] before evaluation.
If a @scheme[datum] has the form @scheme[(eval:alts #,(svar If a @scheme[datum] has the form @scheme[(@#,indexed-scheme[eval:alts]
show-datum) #,(svar eval-datum))], then @svar[show-datum] is typeset, #,(svar show-datum) #,(svar eval-datum))], then @svar[show-datum] is
while @svar[eval-datum] is evaluated.} typeset, while @svar[eval-datum] is evaluated.}
@defform*[[(interaction-eval datum) @defform*[[(interaction-eval datum)