summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-02-11 01:21:17 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-02-11 01:21:17 -0800
commita32e4c21286764c013950015108d745fbdcd97ae (patch)
tree69f35b4dd96b0cf2d99fdcea6068ef13969ec411 /hash.c
parent1e90ef3c7658e2770940f6cb870bb671733cc188 (diff)
downloadtxr-a32e4c21286764c013950015108d745fbdcd97ae.tar.gz
txr-a32e4c21286764c013950015108d745fbdcd97ae.tar.bz2
txr-a32e4c21286764c013950015108d745fbdcd97ae.zip
* combi.c (comb_hash_while_fun, comb_hash_gen_fun, comb_hash): New
static functions. (comb): Support hash tables. * hash.c (print_key_val): When values are nil, print in a more condensed way by omitting the second element. This notation is accepted as input already by the parser. (hash_insert_pair): New function. * txr.1: Description of comb updated to indicate that it works over hashes.
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index 8ce4e4bb..6aac63a0 100644
--- a/hash.c
+++ b/hash.c
@@ -230,7 +230,10 @@ cnum cobj_hash_op(val obj)
static val print_key_val(val out, val key, val value)
{
- format(out, lit(" (~s ~s)"), key, value, nao);
+ if (value)
+ format(out, lit(" (~s ~s)"), key, value, nao);
+ else
+ format(out, lit(" (~s)"), key, nao);
return nil;
}