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:
parent
77e1707aa7
commit
fcd4c4e38d
|
@ -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?)])]{
|
[blocks (listof block?)])]{
|
||||||
|
|
||||||
A @techlink{compound paragraph} has a @tech{style} and a list of
|
A @techlink{compound paragraph} has a @tech{style} and a list of
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
(types convenience utils union subtype)
|
(types convenience utils union subtype)
|
||||||
(rep type-rep)
|
(rep type-rep)
|
||||||
(utils tc-utils)
|
(utils tc-utils)
|
||||||
unstable/sequence
|
unstable/sequence unstable/hash
|
||||||
"signatures.ss" "constraint-structs.ss"
|
"signatures.ss" "constraint-structs.ss"
|
||||||
scheme/match)
|
scheme/match)
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
(require "../utils/utils.ss"
|
(require "../utils/utils.ss"
|
||||||
"signatures.ss" "constraint-structs.ss"
|
"signatures.ss" "constraint-structs.ss"
|
||||||
(utils tc-utils)
|
(utils tc-utils)
|
||||||
unstable/sequence
|
unstable/sequence unstable/hash scheme/match)
|
||||||
scheme/match)
|
|
||||||
|
|
||||||
(import constraints^)
|
(import constraints^)
|
||||||
(export dmap^)
|
(export dmap^)
|
||||||
|
|
|
@ -6,13 +6,12 @@ at least theoretically.
|
||||||
|#
|
|#
|
||||||
|
|
||||||
(require (for-syntax scheme/base syntax/parse scheme/string)
|
(require (for-syntax scheme/base syntax/parse scheme/string)
|
||||||
scheme/contract mzlib/plt-match scheme/require-syntax scheme/provide-syntax
|
scheme/contract scheme/match scheme/require-syntax
|
||||||
mzlib/struct scheme/unit
|
scheme/provide-syntax mzlib/struct scheme/unit
|
||||||
scheme/pretty mzlib/pconvert
|
scheme/pretty mzlib/pconvert syntax/parse)
|
||||||
(except-in syntax/parse id))
|
|
||||||
|
|
||||||
;; to move to unstable
|
;; to move to unstable
|
||||||
(provide == hash-union debug reverse-begin)
|
(provide == debug reverse-begin)
|
||||||
|
|
||||||
(provide
|
(provide
|
||||||
;; timing
|
;; timing
|
||||||
|
@ -186,17 +185,6 @@ at least theoretically.
|
||||||
#'([prop:custom-write pseudo-printer]))
|
#'([prop:custom-write pseudo-printer]))
|
||||||
#f)]))
|
#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.
|
;; turn contracts on and off - off by default for performance.
|
||||||
(define-for-syntax enable-contracts? #f)
|
(define-for-syntax enable-contracts? #f)
|
||||||
|
|
13
collects/unstable/hash.ss
Normal file
13
collects/unstable/hash.ss
Normal 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))))
|
30
collects/unstable/scribblings/hash.scrbl
Normal file
30
collects/unstable/scribblings/hash.scrbl
Normal 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))
|
||||||
|
]
|
||||||
|
}
|
|
@ -85,6 +85,7 @@ Keep documentation and tests up to date.
|
||||||
@include-section["find.scrbl"]
|
@include-section["find.scrbl"]
|
||||||
@include-section["class-iop.scrbl"]
|
@include-section["class-iop.scrbl"]
|
||||||
@include-section["sequence.scrbl"]
|
@include-section["sequence.scrbl"]
|
||||||
|
@include-section["hash.scrbl"]
|
||||||
|
|
||||||
@;{--------}
|
@;{--------}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
#lang at-exp scheme/base
|
#lang at-exp scheme/base
|
||||||
|
|
||||||
(require scribble/base scribble/manual)
|
(require scribble/base scribble/manual scribble/core)
|
||||||
|
|
||||||
(provide unstable addition)
|
(provide unstable addition)
|
||||||
(define (unstable . authors)
|
(define (unstable . authors)
|
||||||
(begin
|
(make-compound-paragraph
|
||||||
(apply author authors)
|
plain
|
||||||
@para{This library is @emph{unstable}; compatibility will not be maintained.
|
(list (apply author authors)
|
||||||
See @secref{unstable} for more information.}))
|
@para{This library is @emph{unstable}
|
||||||
|
; compatibility will not be maintained.
|
||||||
|
See @secref{unstable} for more information.})))
|
||||||
|
|
||||||
(define (addition name)
|
(define (addition name)
|
||||||
@margin-note{The subsequent bindings were added by @|name|.})
|
@margin-note{The subsequent bindings were added by @|name|.})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user