▼ |  | Unstable

1 | Guidelines for developing unstable libraries
2 | Bytes
3 | Contracts
4 | Exceptions
5 | Lists
6 | Net
7 | Path
8 | Source Locations
9 | Strings
10 | Structs
11 | Syntax
12 | Anaphoric Contracts
13 | Finding Mutated Variables
14 | Find
15 | Interface-Oriented Programming for Classes
16 | Sequences
17 | Hash Tables
18 | Match
19 | Skip Lists
20 | Interval Maps
21 | GUI libraries

On this page:

hash-union

top ← prev up next →

### 17`` Hash Tables

Sam Tobin-Hochstadt <samth@ccs.neu.edu>

( require unstable/hash )

This library is unstable; compatibility will not be maintained. See Unstable for more information.

( hash-union t1 t2 combine) → hash?
t1 : hash?
t2 : hash?
combine : ( any/c any/c any/c . -> . any/c )

Produces the combination of t1 and t2. If either t1 or t2 has a value for key k, then the result has the same value for k. If both t1 and t2 have a value for k, the result has the value (combine k ( hash-ref t1 k) ( hash-ref t2 k)) for k.

Examples:
> ( hash-union #hash((b. 0) (a. 5)) #hash((d. 12) (c. 1)) ( lambda (k v1 v2) v1))
#hash((b. 0) (d. 12) (a. 5) (c. 1))
> ( hash-union #hash((b. 0) (a. 5)) #hash((a. 12) (c. 1)) ( lambda (k v1 v2) v1))
#hash((b. 0) (a. 5) (c. 1))

top ← prev up next →