emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#13345: closed (24.2.91; Wrong assumption in a hash


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#13345: closed (24.2.91; Wrong assumption in a hash table example + fix)
Date: Thu, 03 Jan 2013 18:42:01 +0000

Your message dated Thu, 03 Jan 2013 13:41:30 -0500
with message-id <address@hidden>
and subject line Re: bug#13345: 24.2.91; Wrong assumption in a hash table 
example + fix
has caused the debbugs.gnu.org bug report #13345,
regarding 24.2.91; Wrong assumption in a hash table example + fix
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
13345: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13345
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.2.91; Wrong assumption in a hash table example + fix Date: Thu, 03 Jan 2013 14:01:17 +0200
In file doc/lispref/hash.texi, there is an example:

    @example
    (defun case-fold-string= (a b)
      (compare-strings a nil nil b nil nil t))
    (defun case-fold-string-hash (a)
      (sxhash (upcase a)))

    (define-hash-table-test 'case-fold
      'case-fold-string= 'case-fold-string-hash)

    (make-hash-table :test 'case-fold)
    @end example

The documentation of `define-hash-table-test' says:

    The function @var{test-fn} should accept two arguments, two keys, and
    return address@hidden if they are considered ``the same''.

In the above example, the test function returns always non-nil, because
it assumes `compare-strings' returns nil for differing strings. The
patch below fixes this wrong assumption.


2013-01-03  Ari Roponen  <address@hidden>  (tiny change)

        * hash.texi (Defining Hash): Fix example.


=== modified file 'doc/lispref/hash.texi'
--- doc/lispref/hash.texi       2013-01-01 09:11:05 +0000
+++ doc/lispref/hash.texi       2013-01-03 10:50:19 +0000
@@ -293,7 +293,7 @@
 
 @example
 (defun case-fold-string= (a b)
-  (compare-strings a nil nil b nil nil t))
+  (eq t (compare-strings a nil nil b nil nil t)))
 (defun case-fold-string-hash (a)
   (sxhash (upcase a)))
 


In GNU Emacs 24.2.91.9 (x86_64-unknown-linux-gnu, GTK+ Version 3.7.2)
 of 2013-01-03 on arirop
Bzr revision: 111125 address@hidden
Windowing system distributor `Fedora Project', version 11.0.11300000
System Description:     Fedora release 18 (Spherical Cow)

-- 
Ari Roponen



--- End Message ---
--- Begin Message --- Subject: Re: bug#13345: 24.2.91; Wrong assumption in a hash table example + fix Date: Thu, 03 Jan 2013 13:41:30 -0500 User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
Version: 24.2.92

Thanks, applied.
You have a few tiny changes now. Please consider completing a copyright
assignment if you expect to contribute more (forgive me if I already
mentioned this).


--- End Message ---

reply via email to

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