On 5/18/05, Michele Simionato <[EMAIL PROTECTED]> wrote:
> This is one thing I always wanted to ask: what's the rationale for
>
> (hash-table-ref h 'non-existing-key)
>
> returning #f instead of an error? In this way I am never sure if I have
> found a key associated to a false value or if the key was missing.
> I guess there is some backward compatibility reason, otherwise
> the only reasonable behavior for
>
> (hash-table-ref h 'non-existing-key)
>
> is to return an error unless I specify a third argument, such as
>
> (hash-table-ref h 'non-existing-key #f)
>
> Am I missing something?
>
No, the documentation (as usual :-) is missing a few words:
-- procedure: hash-table-ref
(hash-table-ref HASH-TABLE KEY [DEFAULT])
Returns the entry in the given hash-table under `KEY'. If no entry
is stored in the table, `DEFAULT' is returned, or `#f' if
`DEFAULT' is not given.
cheers,
felix
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users