Hello,
the function hash-table-update!/default and also hash-table-update! on
which it is based in CHICKEN do not behave as prescribed by SRFI-69:
$ csi
@@@@@@@ @@@ @@@ @@@ @@@@@@@ @@@ @@@ @@@@@@@@ @@@ @@@
!@@ @@! @@@ @@! !@@ @@! !@@ @@! @@[EMAIL PROTECTED]@@@
[EMAIL PROTECTED] @[EMAIL PROTECTED]@[EMAIL PROTECTED] !!@ [EMAIL
PROTECTED] @!@@[EMAIL PROTECTED] @!!!:! @!@@[EMAIL PROTECTED]
:!! !!: !!! !!: :!! !!: :!! !!: !!: !!!
:: :: : : : : : :: :: : : ::: : :: ::: :: :
Version 2, Build 301 - macosx-unix-gnu-ppc - [ libffi dload ptables ]
(c)2000-2005 Felix L. Winkelmann
#;1> (define ht (make-hash-table))
#;2> (hash-table-update!/default ht 'x add1 0)
#;3> (hash-table-ref ht 'x)
0
The correct return value would be 1 because SRFI-69 states:
Procedure: hash-table-update! hash-table key function [ thunk ] => undefined
Semantically equivalent to, but may be implemented more efficiently
than, the following code:
(hash-table-set! hash-table key
(function (hash-table-ref hash-table key thunk)))
This means, that "function" has to be called, even if the key is not
present in the hashtable, which CHICKEN fails to do.
A patch fixing extras.scm (created with darcs send) is attached.
cu,
Thomas
New patches:
[hashtable-update! fixed to conform to SRFI-69 [Thomas Chust]
Thomas Chust <[EMAIL PROTECTED]>**20060221203303] {
hunk ./extras.scm 1582
- (##sys#setslot vec k (cons (cons key (init))
bucket0))
+ (##sys#setslot vec k (cons (cons key (proc
(init))) bucket0))
hunk ./extras.scm 1591
- (##sys#setslot vec k (cons (cons key (init))
bucket0))
+ (##sys#setslot vec k (cons (cons key (proc
(init))) bucket0))
}
Context:
[- srfi-4.scm: subXXvector range check was wrong [Thanks to Alex Shinn]
[EMAIL PROTECTED]
[- yet another whacky banner
[EMAIL PROTECTED]
- version is 2.301
- delete-file and rename-file didn't expand tilde [Patch by Zbigniew Szadkowsi]
]
[- updated CMake readme and buildfile [thanks to Brandon van Every]
[EMAIL PROTECTED]
[TAG 2.3-release
[EMAIL PROTECTED]
Patch bundle hash:
e67245719420bf01ea85cf456452665018eb41f8
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users