Fix prop values for DrDr.

Add plt-responsible props.
Add hash-union to unstable.
Fix doc for compound-paragraph.
Fix unstable/scribblings/util.

svn: r16811
This commit is contained in:
Sam Tobin-Hochstadt 2009-11-16 13:59:13 +00:00
parent 77e1707aa7
commit fcd4c4e38d
8 changed files with 58 additions and 25 deletions

View File

@ -522,7 +522,7 @@ The following @tech{style properties} are currently recognized:
]}
@defstruct[compound-paragraph ([style any/c]
@defstruct[compound-paragraph ([style style?]
[blocks (listof block?)])]{
A @techlink{compound paragraph} has a @tech{style} and a list of

View File

@ -4,7 +4,7 @@
(types convenience utils union subtype)
(rep type-rep)
(utils tc-utils)
unstable/sequence
unstable/sequence unstable/hash
"signatures.ss" "constraint-structs.ss"
scheme/match)

View File

@ -3,8 +3,7 @@
(require "../utils/utils.ss"
"signatures.ss" "constraint-structs.ss"
(utils tc-utils)
unstable/sequence
scheme/match)
unstable/sequence unstable/hash scheme/match)
(import constraints^)
(export dmap^)

View File

@ -6,13 +6,12 @@ at least theoretically.
|#
(require (for-syntax scheme/base syntax/parse scheme/string)
scheme/contract mzlib/plt-match scheme/require-syntax scheme/provide-syntax
mzlib/struct scheme/unit
scheme/pretty mzlib/pconvert
(except-in syntax/parse id))
scheme/contract scheme/match scheme/require-syntax
scheme/provide-syntax mzlib/struct scheme/unit
scheme/pretty mzlib/pconvert syntax/parse)
;; to move to unstable
(provide == hash-union debug reverse-begin)
(provide == debug reverse-begin)
(provide
;; timing
@ -186,17 +185,6 @@ at least theoretically.
#'([prop:custom-write pseudo-printer]))
#f)]))
;; map map (key val val -> val) -> map
(define (hash-union h1 h2 f)
(for/fold ([h* h1])
([(k v2) h2])
(let* ([v1 (hash-ref h1 k #f)]
[new-val (if v1
(f k v1 v2)
v2)])
(hash-set h* k new-val))))
;; turn contracts on and off - off by default for performance.
(define-for-syntax enable-contracts? #f)

13
collects/unstable/hash.ss Normal file
View File

@ -0,0 +1,13 @@
#lang scheme/base
(provide hash-union)
;; map map (key val val -> val) -> map
(define (hash-union h1 h2 f)
(for/fold ([h* h1])
([(k v2) h2])
(let* ([v1 (hash-ref h1 k #f)]
[new-val (if v1
(f k v1 v2)
v2)])
(hash-set h* k new-val))))

View File

@ -0,0 +1,30 @@
#lang scribble/doc
@(require scribble/base
scribble/manual
scribble/eval
"utils.ss"
(for-label unstable/hash
scheme/contract
scheme/base))
@(define the-eval (make-base-eval))
@(the-eval '(require unstable/hash))
@title[#:tag "hash"]{Hash Tables}
@defmodule[unstable/hash]
@unstable[@author+email["Sam Tobin-Hochstadt" "samth@ccs.neu.edu"]]
@defproc[(hash-union [t1 hash?] [t2 hash?] [combine (any/c any/c any/c . -> . any/c)]) hash?]{
Produces the combination of @scheme[t1] and @scheme[t2]. If either
@scheme[t1] or @scheme[t2] has a value for key @scheme[k], then the
result has the same value for @scheme[k]. If both @scheme[t1] and
@scheme[t2] have a value for @scheme[k], the result has the value
@scheme[(combine k (hash-ref t1 k) (hash-ref t2 k))] for @scheme[k].
@examples[#:eval the-eval
(hash-union #hash((a . 5) (b . 0)) #hash((d . 12) (c . 1)) (lambda (k v1 v2) v1))
(hash-union #hash((a . 5) (b . 0)) #hash((a . 12) (c . 1)) (lambda (k v1 v2) v1))
]
}

View File

@ -85,6 +85,7 @@ Keep documentation and tests up to date.
@include-section["find.scrbl"]
@include-section["class-iop.scrbl"]
@include-section["sequence.scrbl"]
@include-section["hash.scrbl"]
@;{--------}

View File

@ -1,13 +1,15 @@
#lang at-exp scheme/base
(require scribble/base scribble/manual)
(require scribble/base scribble/manual scribble/core)
(provide unstable addition)
(define (unstable . authors)
(begin
(apply author authors)
@para{This library is @emph{unstable}; compatibility will not be maintained.
See @secref{unstable} for more information.}))
(make-compound-paragraph
plain
(list (apply author authors)
@para{This library is @emph{unstable}
; compatibility will not be maintained.
See @secref{unstable} for more information.})))
(define (addition name)
@margin-note{The subsequent bindings were added by @|name|.})