summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-06-24 06:04:43 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-06-24 06:04:43 -0700
commit5a1a9076e10d03a070daa0e8c019fc0ec76e5c88 (patch)
treea57fb2920b46506fd80130a798e59389f8ea9ee5 /txr.1
parent2f654aa0a794581bb857c38e99e0abb185c53d52 (diff)
downloadtxr-5a1a9076e10d03a070daa0e8c019fc0ec76e5c88.tar.gz
txr-5a1a9076e10d03a070daa0e8c019fc0ec76e5c88.tar.bz2
txr-5a1a9076e10d03a070daa0e8c019fc0ec76e5c88.zip
* hash.c (hash_from_pairs, hash_list): New functions.
* hash.h (hash_from_pairs, hash_list): Declared. * eval.c (eval_init): Registered hash-from-pairs and hash-list intrinsic. * txr.1: Documented new functions.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.136
1 files changed, 34 insertions, 2 deletions
diff --git a/txr.1 b/txr.1
index 3a26ad89..c9501c22 100644
--- a/txr.1
+++ b/txr.1
@@ -21723,9 +21723,10 @@ is fully instantiated. In the meanwhile, the
\*(TX program can mutate the hash table from which the lazy list
is being generated.
-.coNP Function @ hash-construct
+.coNP Functions @ hash-construct and @ hash-from-pairs
.synb
.mets (hash-construct < hash-args << key-val-pairs )
+.mets (hash-from-pairs < key-val-pairs << hash-arg *)
.syne
.desc
The
@@ -21740,11 +21741,42 @@ lists representing key-value pairs.
A hash is constructed as if by a call to
.cblk
-.meti [apply hash << hash-args ],
+.meti (apply hash << hash-args ),
.cble
then populated
with the specified pairs, and returned.
+The
+.code hash-from-pairs
+function is an alternative interface to the same semantics. The
+.meta key-val-pairs
+argument is first, and the
+.meta hash-args
+are passed as trailing variadic arguments, rather than a single list argument.
+
+.coNP Function @ hash-list
+.synb
+.mets (hash-list < key-list << hash-arg *)
+.syne
+.desc
+The
+.code hash-list
+function constructs a hash as if by a call to
+.cblk
+.meti (apply hash << hash-args ),
+.cble
+where
+.meta hash-args
+is a list of the individual
+.meta hash-arg
+variadic arguments.
+
+The hash is then populated with keys taken from
+.meta key-list
+and returned.
+
+The value associated with each key is that key itself.
+
.coNP Function @ hash-update
.synb
.mets (hash-update < hash << function )