chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] hash-table-walk + hash-table-delete!


From: Graham Fawcett
Subject: Re: [Chicken-users] hash-table-walk + hash-table-delete!
Date: Mon, 5 Mar 2007 15:13:10 -0500

On 3/5/07, Kon Lovett <address@hidden> wrote:
On Mar 5, 2007, at 11:23 AM, Graham Fawcett wrote:
>> However I think a '(hash-table-remove! hash-table (-> key value
>> boolean))' procedure should be added to "extras.scm" just to be
>> "safe".
>
> Could you please explain that signature? I don't know how to interpret
> your (-> ...) form.

A strict prefix form:

(-> key value boolean) is (key value -> boolean) but should be
(object object -> boolean) since there are no key & value types.

Thanks. I thought it looked like Haskell, and I wasn't that far off.
:-) Wouldn't it be '(hash-table-remove! (-> hash-table key value
boolean)) ? Or do you write it as you did because the procedure
mutates the hash-table?

And lastly, are you passing both key and value in for correctness'
sake (in lieu of passing in the actual bucket, to which we don't have
a reference in a hash-table-walk), or would your implementation
actually test for equality on both before removing?

Graham




reply via email to

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