Merge branch 'master' of git:plt
This commit is contained in:
commit
950fcf14da
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -9,3 +9,8 @@
|
|||
|
||||
# a common convenient place to set the PLTADDON directory to
|
||||
/add-on/
|
||||
|
||||
# common backups, autosaves, and lock files
|
||||
*~
|
||||
\#*
|
||||
.#*
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#lang racket
|
||||
(require racket/init
|
||||
scheme/gui/base)
|
||||
|
||||
(provide (all-from-out racket/init
|
||||
scheme/gui/base))
|
|
@ -1,3 +1,5 @@
|
|||
#lang scheme/private
|
||||
|
||||
(provide (except-out (all-from-out racket/base) struct))
|
||||
(provide (except-out (all-from-out racket/base)
|
||||
struct
|
||||
hash hasheq hasheqv))
|
||||
|
|
|
@ -86,6 +86,11 @@ unpredictable.
|
|||
Returns @scheme[#t] if @scheme[v] is a @tech{hash table}, @scheme[#f]
|
||||
otherwise.}
|
||||
|
||||
@defproc[(hash-equal? [hash hash?]) boolean?]{
|
||||
|
||||
Returns @scheme[#t] if @scheme[hash] compares keys with @scheme[equal?],
|
||||
@scheme[#f] if it compares with @scheme[eq?] or @scheme[eqv?].}
|
||||
|
||||
@defproc[(hash-eqv? [hash hash?]) boolean?]{
|
||||
|
||||
Returns @scheme[#t] if @scheme[hash] compares keys with @scheme[eqv?],
|
||||
|
@ -102,73 +107,69 @@ Returns @scheme[#t] if @scheme[hash] compares keys with @scheme[eq?],
|
|||
Returns @scheme[#t] if @scheme[hash] retains its keys weakly,
|
||||
@scheme[#f] if it retains keys strongly.}
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(hash [key any/c] [val any/c] ... ...) (and/c hash? hash-equal? immutable?)]
|
||||
@defproc[(hasheq [key any/c] [val any/c] ... ...) (and/c hash? hash-eq? immutable?)]
|
||||
@defproc[(hasheqv [key any/c] [val any/c] ... ...) (and/c hash? hash-eqv? immutable?)]
|
||||
)]{
|
||||
|
||||
@defproc[(make-hash [assocs (listof pair?) null]) hash?]{
|
||||
Creates an immutable hash table with each given @scheme[key] mapped to
|
||||
the following @scheme[val]; each @scheme[key] must have a @scheme[val],
|
||||
so the total number of arguments to @scheme[hash] must be even.
|
||||
|
||||
Creates a mutable hash table that holds keys strongly and that uses
|
||||
@scheme[equal?] to compare keys. See also @scheme[make-custom-hash].
|
||||
The @scheme[hash] procedure creates a table where keys are compared
|
||||
with @scheme[equal?], @scheme[hasheq] procedure creates a table where
|
||||
keys are compared with @scheme[eq?], and @scheme[hasheqv] procedure
|
||||
creates a table where keys are compared with @scheme[eqv?].
|
||||
|
||||
The @scheme[key] to @scheme[val] mappings are added to the table in
|
||||
the order that they appear in the argument list, so later mappings can
|
||||
hide earlier mappings if the @scheme[key]s are equal.}
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(make-hash [assocs (listof pair?) null]) (and/c hash? hash-equal?)]
|
||||
@defproc[(make-hasheqv [assocs (listof pair?) null]) (and/c hash? hash-eqv?)]
|
||||
@defproc[(make-hasheq [assocs (listof pair?) null]) (and/c hash? hash-eq?)]
|
||||
)]{
|
||||
|
||||
Creates a mutable hash table that holds keys strongly.
|
||||
|
||||
The @scheme[make-hash] procedure creates a table where keys are
|
||||
compared with @scheme[equal?], @scheme[make-hasheq] procedure creates
|
||||
a table where keys are compared with @scheme[eq?], and
|
||||
@scheme[make-hasheqv] procedure creates a table where keys are
|
||||
compared with @scheme[eqv?].
|
||||
|
||||
The table is initialized with the content of @scheme[assocs]. In each
|
||||
element of @scheme[assocs], the @scheme[car] is a key, and the
|
||||
@scheme[cdr] is the corresponding value. The mappings are added to the
|
||||
table in the order that they appear in @scheme[assocs], so later
|
||||
mappings can hide earlier mappings.}
|
||||
mappings can hide earlier mappings.
|
||||
|
||||
See also @scheme[make-custom-hash].}
|
||||
|
||||
@defproc[(make-hasheqv [assocs (listof pair?) null]) (and/c hash? hash-eqv?)]{
|
||||
|
||||
Creates a mutable hash table that holds keys strongly and that
|
||||
uses @scheme[eqv?] to compare keys. The table is initialized with the
|
||||
content of @scheme[assocs] as in @scheme[make-hash].}
|
||||
|
||||
|
||||
@defproc[(make-hasheq [assocs (listof pair?) null]) (and/c hash? hash-eq?)]{
|
||||
|
||||
Creates a mutable hash table that holds keys strongly and that
|
||||
uses @scheme[eq?] to compare keys. The table is initialized with the
|
||||
content of @scheme[assocs] as in @scheme[make-hash].}
|
||||
|
||||
|
||||
@defproc[(make-weak-hash [assocs (listof pair?) null]) (and/c hash? hash-weak?)]{
|
||||
|
||||
Creates a mutable hash table that holds keys weakly and that
|
||||
uses @scheme[equal?] to compare keys; see also
|
||||
@scheme[make-weak-custom-hash]. The table is initialized with the
|
||||
content of @scheme[assocs] as in @scheme[make-hash].}
|
||||
|
||||
|
||||
@defproc[(make-weak-hasheqv [assocs (listof pair?) null]) (and/c hash? hash-eqv? hash-weak?)]{
|
||||
|
||||
Creates a mutable hash table that holds keys weakly and that
|
||||
uses @scheme[eqv?] to compare keys. The table is initialized with the
|
||||
content of @scheme[assocs] as in @scheme[make-hash].}
|
||||
|
||||
|
||||
@defproc[(make-weak-hasheq [assocs (listof pair?) null]) (and/c hash? hash-eq? hash-weak?)]{
|
||||
|
||||
Creates a mutable hash table that holds keys weakly and that
|
||||
uses @scheme[eq?] to compare keys. The table is initialized with the
|
||||
content of @scheme[assocs] as in @scheme[make-hash].}
|
||||
@deftogether[(
|
||||
@defproc[(make-weak-hash [assocs (listof pair?) null]) (and/c hash? hash-equal? hash-weak?)]
|
||||
@defproc[(make-weak-hasheqv [assocs (listof pair?) null]) (and/c hash? hash-eqv? hash-weak?)]
|
||||
@defproc[(make-weak-hasheq [assocs (listof pair?) null]) (and/c hash? hash-eq? hash-weak?)]
|
||||
)]{
|
||||
|
||||
Like @scheme[make-hash], @scheme[make-hasheq], and
|
||||
@scheme[make-hasheqv], but creates a mutable hash table that holds
|
||||
keys weakly.}
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(make-immutable-hash [assocs (listof pair?)])
|
||||
(and/c hash? immutable?)]{
|
||||
|
||||
Creates an immutable hash table that compares keys with
|
||||
@scheme[equal?]. The table is created with the content of
|
||||
@scheme[assocs] as in @scheme[make-hash].}
|
||||
|
||||
(and/c hash? hash-equal? immutable?)]
|
||||
@defproc[(make-immutable-hasheqv [assocs (listof pair?)])
|
||||
(and/c hash? hash-eqv? immutable?)]{
|
||||
|
||||
Like @scheme[make-immutable-hash], but the resulting hash table
|
||||
compares keys with @scheme[eqv?].}
|
||||
|
||||
(and/c hash? hash-eqv? immutable?)]
|
||||
@defproc[(make-immutable-hasheq [assocs (listof pair?)])
|
||||
(and/c hash? hash-eq? immutable?)]{
|
||||
(and/c hash? hash-eq? immutable?)]
|
||||
)]{
|
||||
|
||||
Like @scheme[make-immutable-hash], but the resulting hash table
|
||||
compares keys with @scheme[eq?].}
|
||||
Like @scheme[hash], @scheme[hasheq], and @scheme[hasheqv], but accepts
|
||||
the key--value mapping in association-list form like
|
||||
@scheme[make-hash], @scheme[make-hasheq], and @scheme[make-hasheqv].}
|
||||
|
||||
|
||||
@defproc[(hash-set! [hash (and/c hash? (not/c immutable?))]
|
||||
|
|
|
@ -49,11 +49,13 @@ Within such specifications,
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket[...] indicates zero or more
|
||||
repetitions of the preceding datum.}
|
||||
@item{@racket[...] indicates zero or more repetitions of the
|
||||
preceding datum; more generally, @math{N} consecutive
|
||||
@racket[...]s a row indicate a consecutive repetition of the
|
||||
preceding @math{N} datums.}
|
||||
|
||||
@item{@racket[...+] indicates one or
|
||||
more repetitions of the preceding datum.}
|
||||
@item{@racket[...+] indicates one or more repetitions of the
|
||||
preceding datum.}
|
||||
|
||||
@item{Italic meta-identifiers play the role of non-terminals. Some
|
||||
meta-identifier names imply syntactic constraints:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -100,11 +100,15 @@ static Scheme_Object *make_weak_hasheqv(int argc, Scheme_Object *argv[]);
|
|||
static Scheme_Object *make_immutable_hash(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *make_immutable_hasheq(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *make_immutable_hasheqv(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *direct_hash(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *direct_hasheq(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *direct_hasheqv(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *hash_table_count(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *hash_table_copy(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *hash_p(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *hash_eq_p(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *hash_eqv_p(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *hash_equal_p(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *hash_weak_p(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *hash_table_put_bang(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *hash_table_put(int argc, Scheme_Object *argv[]);
|
||||
|
@ -511,6 +515,21 @@ scheme_init_list (Scheme_Env *env)
|
|||
"make-immutable-hasheqv",
|
||||
1, 1),
|
||||
env);
|
||||
scheme_add_global_constant("hash",
|
||||
scheme_make_immed_prim(direct_hash,
|
||||
"hash",
|
||||
0, -1),
|
||||
env);
|
||||
scheme_add_global_constant("hasheq",
|
||||
scheme_make_immed_prim(direct_hasheq,
|
||||
"hasheq",
|
||||
0, -1),
|
||||
env);
|
||||
scheme_add_global_constant("hasheqv",
|
||||
scheme_make_immed_prim(direct_hasheqv,
|
||||
"hasheqv",
|
||||
0, -1),
|
||||
env);
|
||||
scheme_add_global_constant("hash?",
|
||||
scheme_make_folding_prim(hash_p,
|
||||
"hash?",
|
||||
|
@ -526,6 +545,11 @@ scheme_init_list (Scheme_Env *env)
|
|||
"hash-eqv?",
|
||||
1, 1, 1),
|
||||
env);
|
||||
scheme_add_global_constant("hash-equal?",
|
||||
scheme_make_folding_prim(hash_equal_p,
|
||||
"hash-equal?",
|
||||
1, 1, 1),
|
||||
env);
|
||||
scheme_add_global_constant("hash-weak?",
|
||||
scheme_make_folding_prim(hash_weak_p,
|
||||
"hash-weak?",
|
||||
|
@ -1817,6 +1841,42 @@ static Scheme_Object *make_immutable_hasheqv(int argc, Scheme_Object *argv[])
|
|||
return make_immutable_table("make-immutable-hasheqv", 2, argc, argv);
|
||||
}
|
||||
|
||||
static Scheme_Object *direct_table(const char *who, int kind, int argc, Scheme_Object *argv[])
|
||||
{
|
||||
int i;
|
||||
Scheme_Hash_Tree *ht;
|
||||
|
||||
if (argc & 0x1) {
|
||||
scheme_arg_mismatch(who,
|
||||
"key does not have a value (i.e., an odd number of arguments were provided): ",
|
||||
argv[argc-1]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ht = scheme_make_hash_tree(kind);
|
||||
|
||||
for (i = 0; i < argc; i += 2) {
|
||||
ht = scheme_hash_tree_set(ht, argv[i], argv[i+1]);
|
||||
}
|
||||
|
||||
return (Scheme_Object *)ht;
|
||||
}
|
||||
|
||||
static Scheme_Object *direct_hash(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
return direct_table("hash", 1, argc, argv);
|
||||
}
|
||||
|
||||
static Scheme_Object *direct_hasheq(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
return direct_table("hasheq", 0, argc, argv);
|
||||
}
|
||||
|
||||
static Scheme_Object *direct_hasheqv(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
return direct_table("hasheqv", 2, argc, argv);
|
||||
}
|
||||
|
||||
Scheme_Hash_Table *scheme_make_hash_table_equal()
|
||||
{
|
||||
Scheme_Hash_Table *t;
|
||||
|
@ -2005,6 +2065,29 @@ static Scheme_Object *hash_eqv_p(int argc, Scheme_Object *argv[])
|
|||
return scheme_false;
|
||||
}
|
||||
|
||||
static Scheme_Object *hash_equal_p(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
Scheme_Object *o = argv[0];
|
||||
|
||||
if (SCHEME_CHAPERONEP(o))
|
||||
o = SCHEME_CHAPERONE_VAL(o);
|
||||
|
||||
if (SCHEME_HASHTP(o)) {
|
||||
if (((Scheme_Hash_Table *)o)->compare == compare_equal)
|
||||
return scheme_true;
|
||||
} else if (SCHEME_HASHTRP(o)) {
|
||||
if (SCHEME_HASHTR_FLAGS((Scheme_Hash_Tree *)o) & 0x1)
|
||||
return scheme_true;
|
||||
} else if (SCHEME_BUCKTP(o)) {
|
||||
if (((Scheme_Bucket_Table *)o)->compare == compare_equal)
|
||||
return scheme_true;
|
||||
} else {
|
||||
scheme_wrong_type("hash-equal?", "hash", 0, argc, argv);
|
||||
}
|
||||
|
||||
return scheme_false;
|
||||
}
|
||||
|
||||
static Scheme_Object *hash_weak_p(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
Scheme_Object *o = argv[0];
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#define USE_COMPILED_STARTUP 1
|
||||
|
||||
#define EXPECTED_PRIM_COUNT 988
|
||||
#define EXPECTED_PRIM_COUNT 992
|
||||
#define EXPECTED_UNSAFE_COUNT 65
|
||||
#define EXPECTED_FLFXNUM_COUNT 53
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
consistently.)
|
||||
*/
|
||||
|
||||
#define MZSCHEME_VERSION "4.2.5.10"
|
||||
#define MZSCHEME_VERSION "4.2.5.11"
|
||||
|
||||
#define MZSCHEME_VERSION_X 4
|
||||
#define MZSCHEME_VERSION_Y 2
|
||||
#define MZSCHEME_VERSION_Z 5
|
||||
#define MZSCHEME_VERSION_W 10
|
||||
#define MZSCHEME_VERSION_W 11
|
||||
|
||||
#define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y)
|
||||
#define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W)
|
||||
|
|
Loading…
Reference in New Issue
Block a user