chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] hash-table with missing keys


From: felix winkelmann
Subject: Re: [Chicken-users] hash-table with missing keys
Date: Wed, 18 May 2005 22:00:26 +0200

On 5/18/05, Michele Simionato <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]