Re: Community preference so far?
taylanbayirli@xxxxxx 30 Sep 2015 10:03 UTC
xxxxxx@gmail.com (Taylan Ulrich "Bayırlı/Kammer") writes:
> Add1 and sub1 are similarly trivial definitions, but if you say they're
> so common, then I have no problem adding them under misc. procedures.
> Will do in a moment.
I now defined:
=====
- `(hashtable-inc! hashtable key)` (procedure)
- `(hashtable-inc! hashtable key x)`
Effectively equivalent to:
(hashtable-update! hashtable key (lambda (x) (+ x k)) 0)
where x is 1 when not provided.
- `(hashtable-dec! hashtable key)` (procedure)
- `(hashtable-dec! hashtable key x)`
Effectively equivalent to:
(hashtable-update! hashtable key (lambda (x) (- x k)) #f)
where x is 1 when not provided.
=====
Are these OK? In particular, is it OK that dec! errors when no
association exists, and inc! makes it start from 0 automatically?
Taylan