unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Which hashtable API to use?
@ 2013-08-16 11:38 Alexandru Cojocaru
  2013-08-16 12:47 ` Matt Wette
  2013-08-16 14:08 ` Thien-Thi Nguyen
  0 siblings, 2 replies; 5+ messages in thread
From: Alexandru Cojocaru @ 2013-08-16 11:38 UTC (permalink / raw)
  To: guile-user

Hi,
currently there are three hashtable APIs: R6RS, SRFI-69 and Guile's one.
Which one to choose?

Also what's exactly the difference between hash, hashq and hashv?

Best regards,
Alexandru Cojocaru



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Which hashtable API to use?
  2013-08-16 11:38 Which hashtable API to use? Alexandru Cojocaru
@ 2013-08-16 12:47 ` Matt Wette
  2013-08-16 13:33   ` Alexandru Cojocaru
  2013-08-16 14:08 ` Thien-Thi Nguyen
  1 sibling, 1 reply; 5+ messages in thread
From: Matt Wette @ 2013-08-16 12:47 UTC (permalink / raw)
  To: Alexandru Cojocaru; +Cc: guile-user

WIth respect to your second question: hash table operations can compare keys with equal?, eq?, or eqv?.
Which one do you want to use?

On Aug 16, 2013, at 4:38 AM, Alexandru Cojocaru wrote:

> Hi,
> currently there are three hashtable APIs: R6RS, SRFI-69 and Guile's one.
> Which one to choose?
> 
> Also what's exactly the difference between hash, hashq and hashv?
> 
> Best regards,
> Alexandru Cojocaru
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Which hashtable API to use?
  2013-08-16 12:47 ` Matt Wette
@ 2013-08-16 13:33   ` Alexandru Cojocaru
  2013-08-17  0:00     ` Matt Wette
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandru Cojocaru @ 2013-08-16 13:33 UTC (permalink / raw)
  To: Matt Wette; +Cc: guile-user

Ok, I got it. Basicaly if I do `(hash '(a) 3)' I'll always get the same 
hash because it uses the contents of the list,
while if I do `(hashq '(a) 3)' I may get different hashes because it 
uses the list's pointer address.

On 16.08.2013 14:47, Matt Wette wrote:
> WIth respect to your second question: hash table operations can compare keys with equal?, eq?, or eqv?.
> Which one do you want to use?
>
> On Aug 16, 2013, at 4:38 AM, Alexandru Cojocaru wrote:
>
>> Hi,
>> currently there are three hashtable APIs: R6RS, SRFI-69 and Guile's one.
>> Which one to choose?
>>
>> Also what's exactly the difference between hash, hashq and hashv?
>>
>> Best regards,
>> Alexandru Cojocaru
>>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Which hashtable API to use?
  2013-08-16 11:38 Which hashtable API to use? Alexandru Cojocaru
  2013-08-16 12:47 ` Matt Wette
@ 2013-08-16 14:08 ` Thien-Thi Nguyen
  1 sibling, 0 replies; 5+ messages in thread
From: Thien-Thi Nguyen @ 2013-08-16 14:08 UTC (permalink / raw)
  To: Alexandru Cojocaru; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

() Alexandru Cojocaru <xojoc@gmx.com>
() Fri, 16 Aug 2013 13:38:38 +0200

   currently there are three hashtable APIs [...]
   Which one to choose?

It's best to choose what you feel comfortable maintaining.
It's next best to choose what you can write and understand.
After that is cut and paste copying from other people's code.
Worst is abiding blindly by advice in a j.r.hacker posting...

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Which hashtable API to use?
  2013-08-16 13:33   ` Alexandru Cojocaru
@ 2013-08-17  0:00     ` Matt Wette
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Wette @ 2013-08-17  0:00 UTC (permalink / raw)
  To: Alexandru Cojocaru; +Cc: guile-user

guile> (define ht (make-hash-table 7))
guile> (hash-set! ht "matt" "awesome")
"awesome"
guile> (hashq-ref ht "matt")
#f
guile> (hash-ref ht "matt")
"awesome"

On Aug 16, 2013, at 6:33 AM, Alexandru Cojocaru wrote:

> Ok, I got it. Basicaly if I do `(hash '(a) 3)' I'll always get the same hash because it uses the contents of the list,
> while if I do `(hashq '(a) 3)' I may get different hashes because it uses the list's pointer address.
> 
> On 16.08.2013 14:47, Matt Wette wrote:
>> WIth respect to your second question: hash table operations can compare keys with equal?, eq?, or eqv?.
>> Which one do you want to use?
>> 
>> On Aug 16, 2013, at 4:38 AM, Alexandru Cojocaru wrote:
>> 
>>> Hi,
>>> currently there are three hashtable APIs: R6RS, SRFI-69 and Guile's one.
>>> Which one to choose?
>>> 
>>> Also what's exactly the difference between hash, hashq and hashv?
>>> 
>>> Best regards,
>>> Alexandru Cojocaru
>>> 
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-17  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-16 11:38 Which hashtable API to use? Alexandru Cojocaru
2013-08-16 12:47 ` Matt Wette
2013-08-16 13:33   ` Alexandru Cojocaru
2013-08-17  0:00     ` Matt Wette
2013-08-16 14:08 ` Thien-Thi Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).