Newlines at EOFs.

This commit is contained in:
Eli Barzilay 2012-11-06 14:07:15 -05:00
parent 95679bdab5
commit 14d8c8b5a5
39 changed files with 122 additions and 158 deletions

View File

@ -125,4 +125,4 @@ order, on each iteration.
} }
@close-eval[the-eval] @close-eval[the-eval]

View File

@ -21,14 +21,14 @@ Binary heaps are a simple implementation of priority queues.
Makes a new empty heap using @racket[<=?] to order elements. Makes a new empty heap using @racket[<=?] to order elements.
@examples[#:eval the-eval @examples[#:eval the-eval
(define a-heap-of-strings (make-heap string<=?)) (define a-heap-of-strings (make-heap string<=?))
a-heap-of-strings a-heap-of-strings
@code:comment{With structs:} @code:comment{With structs:}
(struct node (name val)) (struct node (name val))
(define (node<=? x y) (define (node<=? x y)
(<= (node-val x) (node-val y))) (<= (node-val x) (node-val y)))
(define a-heap-of-nodes (make-heap node<=?)) (define a-heap-of-nodes (make-heap node<=?))
a-heap-of-nodes] a-heap-of-nodes]
} }
@defproc[(heap? [x any/c]) boolean?]{ @defproc[(heap? [x any/c]) boolean?]{
@ -36,17 +36,17 @@ a-heap-of-nodes]
Returns @racket[#t] if @racket[x] is a heap, @racket[#f] otherwise. Returns @racket[#t] if @racket[x] is a heap, @racket[#f] otherwise.
@examples[#:eval the-eval @examples[#:eval the-eval
(heap? (make-heap <=)) (heap? (make-heap <=))
(heap? "I am not a heap")] (heap? "I am not a heap")]
} }
@defproc[(heap-count [h heap?]) exact-nonnegative-integer?]{ @defproc[(heap-count [h heap?]) exact-nonnegative-integer?]{
Returns the number of elements in the heap. Returns the number of elements in the heap.
@examples[#:eval the-eval @examples[#:eval the-eval
(define a-heap (make-heap <=)) (define a-heap (make-heap <=))
(heap-add-all! a-heap '(7 3 9 1 13 21 15 31)) (heap-add-all! a-heap '(7 3 9 1 13 21 15 31))
(heap-count a-heap) (heap-count a-heap)
] ]
} }
@ -55,8 +55,8 @@ Returns the number of elements in the heap.
Adds each @racket[v] to the heap. Adds each @racket[v] to the heap.
@examples[#:eval the-eval @examples[#:eval the-eval
(define a-heap (make-heap <=)) (define a-heap (make-heap <=))
(heap-add! a-heap 2009 1009)] (heap-add! a-heap 2009 1009)]
} }
@ -66,14 +66,14 @@ Adds each element contained in @racket[v] to the heap, leaving
@racket[v] unchanged. @racket[v] unchanged.
@examples[#:eval the-eval @examples[#:eval the-eval
(define heap-1 (make-heap <=)) (define heap-1 (make-heap <=))
(define heap-2 (make-heap <=)) (define heap-2 (make-heap <=))
(define heap-12 (make-heap <=)) (define heap-12 (make-heap <=))
(heap-add-all! heap-1 '(3 1 4 1 5 9 2 6)) (heap-add-all! heap-1 '(3 1 4 1 5 9 2 6))
(heap-add-all! heap-2 #(2 7 1 8 2 8 1 8)) (heap-add-all! heap-2 #(2 7 1 8 2 8 1 8))
(heap-add-all! heap-12 heap-1) (heap-add-all! heap-12 heap-1)
(heap-add-all! heap-12 heap-2) (heap-add-all! heap-12 heap-2)
(heap-count heap-12)] (heap-count heap-12)]
} }
@defproc[(heap-min [h heap?]) any/c]{ @defproc[(heap-min [h heap?]) any/c]{
@ -82,13 +82,13 @@ Returns the least element in the heap @racket[h], according to the
heap's ordering. If the heap is empty, an exception is raised. heap's ordering. If the heap is empty, an exception is raised.
@examples[#:eval the-eval @examples[#:eval the-eval
(define a-heap (make-heap string<=?)) (define a-heap (make-heap string<=?))
(heap-add! a-heap "sneezy" "sleepy" "dopey" "doc" (heap-add! a-heap "sneezy" "sleepy" "dopey" "doc"
"happy" "bashful" "grumpy") "happy" "bashful" "grumpy")
(heap-min a-heap) (heap-min a-heap)
@code:comment{Taking the min of the empty heap is an error:} @code:comment{Taking the min of the empty heap is an error:}
(heap-min (make-heap <=)) (heap-min (make-heap <=))
] ]
} }
@ -98,13 +98,13 @@ Removes the least element in the heap @racket[h]. If the heap is
empty, an exception is raised. empty, an exception is raised.
@examples[#:eval the-eval @examples[#:eval the-eval
(define a-heap (make-heap string<=?)) (define a-heap (make-heap string<=?))
(heap-add! a-heap "fili" "fili" "oin" "gloin" "thorin" (heap-add! a-heap "fili" "fili" "oin" "gloin" "thorin"
"dwalin" "balin" "bifur" "bofur" "dwalin" "balin" "bifur" "bofur"
"bombur" "dori" "nori" "ori") "bombur" "dori" "nori" "ori")
(heap-min a-heap) (heap-min a-heap)
(heap-remove-min! a-heap) (heap-remove-min! a-heap)
(heap-min a-heap)] (heap-min a-heap)]
} }
@defproc[(vector->heap [<=? (-> any/c any/c any/c)] [items vector?]) heap?]{ @defproc[(vector->heap [<=? (-> any/c any/c any/c)] [items vector?]) heap?]{
@ -112,12 +112,12 @@ empty, an exception is raised.
Builds a heap with the elements from @racket[items]. The vector is not Builds a heap with the elements from @racket[items]. The vector is not
modified. modified.
@examples[#:eval the-eval @examples[#:eval the-eval
(struct item (val frequency)) (struct item (val frequency))
(define (item<=? x y) (define (item<=? x y)
(<= (item-frequency x) (item-frequency y))) (<= (item-frequency x) (item-frequency y)))
(define some-sample-items (define some-sample-items
(vector (item #\a 17) (item #\b 12) (item #\c 19))) (vector (item #\a 17) (item #\b 12) (item #\c 19)))
(define a-heap (vector->heap item<=? some-sample-items)) (define a-heap (vector->heap item<=? some-sample-items))
] ]
} }
@ -127,9 +127,9 @@ Returns a vector containing the elements of heap @racket[h] in the
heap's order. The heap is not modified. heap's order. The heap is not modified.
@examples[#:eval the-eval @examples[#:eval the-eval
(define word-heap (make-heap string<=?)) (define word-heap (make-heap string<=?))
(heap-add! word-heap "pile" "mound" "agglomerate" "cumulation") (heap-add! word-heap "pile" "mound" "agglomerate" "cumulation")
(heap->vector word-heap) (heap->vector word-heap)
] ]
} }
@ -137,12 +137,12 @@ heap's order. The heap is not modified.
Makes a copy of heap @racket[h]. Makes a copy of heap @racket[h].
@examples[#:eval the-eval @examples[#:eval the-eval
(define word-heap (make-heap string<=?)) (define word-heap (make-heap string<=?))
(heap-add! word-heap "pile" "mound" "agglomerate" "cumulation") (heap-add! word-heap "pile" "mound" "agglomerate" "cumulation")
(define a-copy (heap-copy word-heap)) (define a-copy (heap-copy word-heap))
(heap-remove-min! a-copy) (heap-remove-min! a-copy)
(heap-count word-heap) (heap-count word-heap)
(heap-count a-copy) (heap-count a-copy)
] ]
} }
@ -154,14 +154,13 @@ Makes a copy of heap @racket[h].
Sorts vector @racket[v] using the comparison function @racket[<=?]. Sorts vector @racket[v] using the comparison function @racket[<=?].
@examples[#:eval the-eval @examples[#:eval the-eval
(define terms (vector "batch" "deal" "flock" "good deal" "hatful" "lot")) (define terms (vector "batch" "deal" "flock" "good deal" "hatful" "lot"))
(heap-sort! string<=? terms) (heap-sort! string<=? terms)
terms terms
] ]
} }
@defproc[(in-heap/consume! [heap heap?]) sequence?]{ @defproc[(in-heap/consume! [heap heap?]) sequence?]{
Returns a sequence equivalent to @racket[heap], maintaining the heap's ordering. Returns a sequence equivalent to @racket[heap], maintaining the heap's ordering.
The heap is consumed in the process. Equivalent to repeated calling The heap is consumed in the process. Equivalent to repeated calling
@ -170,12 +169,13 @@ The heap is consumed in the process. Equivalent to repeated calling
@examples[#:eval the-eval @examples[#:eval the-eval
(define h (make-heap <=)) (define h (make-heap <=))
(heap-add-all! h '(50 40 10 20 30)) (heap-add-all! h '(50 40 10 20 30))
(for ([x (in-heap/consume! h)]) (for ([x (in-heap/consume! h)])
(displayln x)) (displayln x))
(heap-count h)] (heap-count h)]
} }
@defproc[(in-heap [heap heap?]) sequence?]{ @defproc[(in-heap [heap heap?]) sequence?]{
Returns a sequence equivalent to @racket[heap], maintaining the heap's ordering. Returns a sequence equivalent to @racket[heap], maintaining the heap's ordering.
Equivalent to @racket[in-heap/consume!] except the heap is copied first. Equivalent to @racket[in-heap/consume!] except the heap is copied first.
@ -183,11 +183,12 @@ Equivalent to @racket[in-heap/consume!] except the heap is copied first.
@examples[#:eval the-eval @examples[#:eval the-eval
(define h (make-heap <=)) (define h (make-heap <=))
(heap-add-all! h '(50 40 10 20 30)) (heap-add-all! h '(50 40 10 20 30))
(for ([x (in-heap h)]) (for ([x (in-heap h)])
(displayln x)) (displayln x))
(heap-count h)] (heap-count h)]
} }
@close-eval[the-eval]
@close-eval[the-eval]

View File

@ -153,4 +153,4 @@ Returns true if every integer in @racket[x] is also in
@racket[y], otherwise @racket[#f].} @racket[y], otherwise @racket[#f].}
@close-eval[the-eval] @close-eval[the-eval]

View File

@ -168,4 +168,5 @@ Returns @racket[#t] if @racket[v] represents a position in an
interval-map, @racket[#f] otherwise. interval-map, @racket[#f] otherwise.
} }
@close-eval[the-eval]
@close-eval[the-eval]

View File

@ -96,5 +96,4 @@ Returns a sequence whose elements are the elements of
} }
@close-eval[qeval]
@close-eval[qeval]

View File

@ -173,4 +173,4 @@ Returns an association list with the keys and values of
} }
@close-eval[the-eval] @close-eval[the-eval]

View File

@ -176,4 +176,4 @@ order.
} }
@close-eval[the-eval] @close-eval[the-eval]

View File

@ -11,11 +11,11 @@
insert-auto-text) insert-auto-text)
;; from module-language-tools.rkt ;; from module-language-tools.rkt
(define-local-member-name (define-local-member-name
when-initialized when-initialized
;move-to-new-language ;move-to-new-language
get-in-module-language?) get-in-module-language?)
;; for keybindings (otherwise private) ;; for keybindings (otherwise private)
(define-local-member-name (define-local-member-name
jump-to-previous-error-loc jump-to-previous-error-loc
@ -28,4 +28,4 @@
;; used by the test suite to tell when the ;; used by the test suite to tell when the
;; online check syntax has finished ;; online check syntax has finished
(define-local-member-name (define-local-member-name
get-online-expansion-colors) get-online-expansion-colors)

View File

@ -22,5 +22,4 @@ that is the MD5 hash of the given input stream or byte string.
]} ]}
@close-eval[md5-eval]
@close-eval[md5-eval]

View File

@ -42,4 +42,4 @@ byte in @racket[bstr] is converted to its two-digit hexadecimal
representation in the resulting string.} representation in the resulting string.}
@close-eval[sha1-eval] @close-eval[sha1-eval]

View File

@ -477,4 +477,4 @@ Constants used within @racketmodname[images/icons/tool].
} }
@close-eval[icons-eval] @close-eval[icons-eval]

View File

@ -40,5 +40,4 @@ Returns the macro stepper logo.
} }
@close-eval[logos-eval]
@close-eval[logos-eval]

View File

@ -569,5 +569,4 @@ module path and the module paths of its immediate dependents.
} }
@close-eval[the-eval]
@close-eval[the-eval]

View File

@ -95,5 +95,4 @@ running @racket[read-eval-print]. In addition, @racket[current-exit]
is set to escape from the call to @racket[new-cafe].} is set to escape from the call to @racket[new-cafe].}
@close-eval[compat-eval]
@close-eval[compat-eval]

View File

@ -271,5 +271,4 @@ Creates a new hash-table providing the quoted flags (if any) to
corresponding values.} corresponding values.}
@close-eval[etc-eval]
@close-eval[etc-eval]

View File

@ -449,7 +449,4 @@ if the @racket[args] list is imbalanced, and the search stops at a
non-keyword value.)} non-keyword value.)}
@close-eval[kw-eval]
@close-eval[kw-eval]

View File

@ -67,6 +67,4 @@ Builds a function that accepts a structure type instance (matching
structure type instance.} structure type instance.}
@close-eval[struct-eval]
@close-eval[struct-eval]

View File

@ -189,5 +189,4 @@ Imports nothing, exports @racket[cookie^].}
Includes everything exported by the @racketmodname[net/cookie] module. Includes everything exported by the @racketmodname[net/cookie] module.
@close-eval[cookie-eval]
@close-eval[cookie-eval]

View File

@ -243,5 +243,4 @@ Imports nothing, exports @racket[head^].}
Includes everything exported by the @racketmodname[net/head] module. Includes everything exported by the @racketmodname[net/head] module.
@close-eval[head-eval]
@close-eval[head-eval]

View File

@ -1459,5 +1459,4 @@ frozen structure in @racket[F].}
] ]
@close-eval[racklog-eval]
@close-eval[racklog-eval]

View File

@ -3100,7 +3100,4 @@ column-span of the new lw is always zero.
} }
@close-eval[redex-eval]
@close-eval[redex-eval]

View File

@ -1124,5 +1124,4 @@ is rendered as @racketblock[Γ ⊢ e : t]
@generate-bibliography[] @generate-bibliography[]
@close-eval[amb-eval]
@close-eval[amb-eval]

View File

@ -766,4 +766,4 @@ Different kinds of bitmaps can produce different results:
] ]
@close-eval[draw-eval] @close-eval[draw-eval]

View File

@ -344,6 +344,4 @@ Analogous to @racket[(unsafe!)], makes unsafe bindings of
module.} module.}
@close-eval[objc-eval]
@close-eval[objc-eval]

View File

@ -479,5 +479,4 @@ annotates operations that can be inlined by the compiler (see
decompiler can be used to help predict parallel performance. decompiler can be used to help predict parallel performance.
@close-eval[future-eval]
@close-eval[future-eval]

View File

@ -298,7 +298,7 @@ Returns @racket[(not v)].}
If exactly one of @racket[b1] and @racket[b2] is If exactly one of @racket[b1] and @racket[b2] is
not @racket[#f], then return it. Otherwise, returns not @racket[#f], then return it. Otherwise, returns
@racket[#f]. @racket[#f].
@examples[#:eval @examples[#:eval
bool-eval bool-eval
(xor 11 #f) (xor 11 #f)
@ -309,5 +309,4 @@ Returns @racket[(not v)].}
} }
@close-eval[bool-eval]
@close-eval[bool-eval]

View File

@ -202,6 +202,4 @@ allocated in the @tech{shared memory space}.
@mz-examples[#:eval flfx-eval (make-shared-fxvector 4 3)]} @mz-examples[#:eval flfx-eval (make-shared-fxvector 4 3)]}
@close-eval[flfx-eval]
@close-eval[flfx-eval]

View File

@ -1,9 +1,9 @@
#lang scribble/doc #lang scribble/doc
@(require "mz.rkt" (for-label racket/trace) @(require "mz.rkt" (for-label racket/trace)
scribble/eval) scribble/eval)
@(begin (define ev (make-base-eval)) @(begin (define ev (make-base-eval))
(ev '(require racket/trace))) (ev '(require racket/trace)))
@title{Tracing} @title{Tracing}
@ -80,8 +80,8 @@ trace information during the call, as described above in the docs for
} }
@defparam[current-trace-print-args trace-print-args @defparam[current-trace-print-args trace-print-args
(-> symbol? (-> symbol?
list? list?
(listof keyword?) (listof keyword?)
list? list?
number? number?
@ -95,8 +95,8 @@ number indicating the depth of the call.
} }
@defparam[current-trace-print-results trace-print-results @defparam[current-trace-print-results trace-print-results
(-> symbol? (-> symbol?
list? list?
number? number?
any)]{ any)]{
@ -105,7 +105,7 @@ traced call. It receives the name of the function, the function's
results, and a number indicating the depth of the call. results, and a number indicating the depth of the call.
} }
@defparam[current-prefix-in prefix string?]{ @defparam[current-prefix-in prefix string?]{
This string is used by the default value of @racket[current-trace-print-args] This string is used by the default value of @racket[current-trace-print-args]
indicating that the current line is showing the a call to a indicating that the current line is showing the a call to a
@ -114,7 +114,7 @@ results, and a number indicating the depth of the call.
It defaults to @racket[">"]. It defaults to @racket[">"].
} }
@defparam[current-prefix-out prefix string?]{ @defparam[current-prefix-out prefix string?]{
This string is used by the default value of @racket[current-trace-print-results] This string is used by the default value of @racket[current-trace-print-results]
indicating that the current line is showing the result indicating that the current line is showing the result
@ -124,6 +124,4 @@ results, and a number indicating the depth of the call.
} }
@close-eval[ev]
@close-eval[ev]

View File

@ -275,5 +275,4 @@ A @techlink{check-procedure} that accepts syntax booleans.
} }
@close-eval[the-eval]
@close-eval[the-eval]

View File

@ -60,6 +60,4 @@ refman]{module path index}; in this case, the
contains the ``self'' index.} contains the ``self'' index.}
@close-eval[evaluator]
@close-eval[evaluator]

View File

@ -84,4 +84,3 @@
[lst (for/list ([x (in-heap/consume! h)]) x)]) [lst (for/list ([x (in-heap/consume! h)]) x)])
(heap-count h)) (heap-count h))
0) 0)

View File

@ -1,7 +1,7 @@
#lang scribble/manual #lang scribble/manual
@begin[(require (for-label (only-meta-in 0 typed/racket)) scribble/eval @begin[(require (for-label (only-meta-in 0 typed/racket)) scribble/eval
"../utils.rkt" (only-in "quick.scrbl" typed-mod))] "../utils.rkt" (only-in "quick.scrbl" typed-mod))]
@(define the-eval (make-base-eval)) @(define the-eval (make-base-eval))
@(the-eval '(require typed/racket)) @(the-eval '(require typed/racket))
@ -133,5 +133,4 @@ Typed Racket also attempts to detect more than one error in the module.
} }
@close-eval[the-eval]
@close-eval[the-eval]

View File

@ -36,12 +36,12 @@ Each of the subsequent macros compile to instances of the machines provided by t
boolean?]{ boolean?]{
Returns @racket[#t] if @racket[m] ends in an accepting state after consuming every element of @racket[i]. Returns @racket[#t] if @racket[m] ends in an accepting state after consuming every element of @racket[i].
} }
@defproc[(machine-accepts?/prefix-closed [m machine?] [i (listof any/c)]) @defproc[(machine-accepts?/prefix-closed [m machine?] [i (listof any/c)])
boolean?]{ boolean?]{
Returns @racket[#t] if @racket[m] stays in an accepting state during the consumption of every element of @racket[i]. Returns @racket[#t] if @racket[m] stays in an accepting state during the consumption of every element of @racket[i].
} }
@defthing[machine-null machine?]{ @defthing[machine-null machine?]{
A machine that is never accepting. A machine that is never accepting.
} }
@ -63,28 +63,28 @@ Each of the subsequent macros compile to instances of the machines provided by t
machine?]{ machine?]{
A machine that simulates the Kleene star of @racket[m]. @racket[m] may be invoked many times. A machine that simulates the Kleene star of @racket[m]. @racket[m] may be invoked many times.
} }
@defproc[(machine-union [m0 machine?] [m1 machine?]) @defproc[(machine-union [m0 machine?] [m1 machine?])
machine?]{ machine?]{
A machine that simulates the union of @racket[m0] and @racket[m1]. A machine that simulates the union of @racket[m0] and @racket[m1].
} }
@defproc[(machine-intersect [m0 machine?] [m1 machine?]) @defproc[(machine-intersect [m0 machine?] [m1 machine?])
machine?]{ machine?]{
A machine that simulates the intersection of @racket[m0] and @racket[m1]. A machine that simulates the intersection of @racket[m0] and @racket[m1].
} }
@defproc[(machine-seq [m0 machine?] [m1 machine?]) @defproc[(machine-seq [m0 machine?] [m1 machine?])
machine?]{ machine?]{
A machine that simulates the sequencing of @racket[m0] and @racket[m1]. @racket[m1] may be invoked many times. A machine that simulates the sequencing of @racket[m0] and @racket[m1]. @racket[m1] may be invoked many times.
} }
@defproc[(machine-seq* [m0 machine?] [make-m1 (-> machine?)]) @defproc[(machine-seq* [m0 machine?] [make-m1 (-> machine?)])
machine?]{ machine?]{
A machine that simulates the sequencing of @racket[m0] and @racket[(make-m1)]. A machine that simulates the sequencing of @racket[m0] and @racket[(make-m1)].
@racket[(make-m1)] may be invoked many times. @racket[(make-m1)] may be invoked many times.
} }
@section[#:tag "dfa"]{Deterministic Finite Automata} @section[#:tag "dfa"]{Deterministic Finite Automata}
@ -214,5 +214,4 @@ This module provides a macro for non-deterministic finite automata with epsilon
@include-section["re.scrbl"] @include-section["re.scrbl"]
@close-eval[our-eval]
@close-eval[our-eval]

View File

@ -206,5 +206,4 @@ This module provides a few transformers that extend the syntax of regular expres
(list 1 0)])] (list 1 0)])]
@close-eval[our-eval]
@close-eval[our-eval]

View File

@ -66,5 +66,4 @@ When attached to a struct type, automatically generates a printer using
} }
@close-eval[the-eval]
@close-eval[the-eval]

View File

@ -155,5 +155,4 @@ listeners.
} }
@close-eval[the-eval]
@close-eval[the-eval]

View File

@ -13,7 +13,7 @@ This module provides tools for logging.
@defproc[(with-logging-to-port @defproc[(with-logging-to-port
[port output-port?] [proc (-> any)] [port output-port?] [proc (-> any)]
[log-spec (or/c 'fatal 'error 'warning 'info 'debug symbol? #f)] ...) [log-spec (or/c 'fatal 'error 'warning 'info 'debug symbol? #f)] ...)
any]{ any]{
Runs @racket[proc], outputting any logging that would be received by Runs @racket[proc], outputting any logging that would be received by
@ -35,8 +35,8 @@ Returns whatever @racket[proc] returns.
[interceptor (-> (vector/c [interceptor (-> (vector/c
(or/c 'fatal 'error 'warning 'info 'debug) (or/c 'fatal 'error 'warning 'info 'debug)
string? string?
any/c) any/c)
any)] any)]
[proc (-> any)] [proc (-> any)]
[log-spec (or/c 'fatal 'error 'warning 'info 'debug symbol? #f)] ...) [log-spec (or/c 'fatal 'error 'warning 'info 'debug symbol? #f)] ...)
any]{ any]{
@ -88,5 +88,4 @@ will then return a list of the log messages that have been reported.
]} ]}
@close-eval[the-eval]
@close-eval[the-eval]

View File

@ -21,5 +21,4 @@ Note that these variables must have values accepted by
} }
@close-eval[the-eval]
@close-eval[the-eval]

View File

@ -59,5 +59,4 @@ Corresponds to @racket[parameterize*], but can parameterize parameter groups as
} }
@close-eval[evaluator]
@close-eval[evaluator]