Raymond Toy pushed to branch issue-240-set-diff-with-hash-table at cmucl / cmucl
Commits: d6aae1fe by Raymond Toy at 2023-07-26T18:35:56-07:00 Revert change that converted cond to case
The use of `case` insted of `cond` didn't work as we naively expected. Change it back to using `cond`.
- - - - - 3fbae4d0 by Raymond Toy at 2023-07-26T18:40:57-07:00 Fix args to list-to-hashtable
Originally, we had the args in the order `test`, `test-not`, and `key`. We really should have `key`, `test`, and `test-not`. That's how set-difference was calling `list-to-hashtable`, and it make more sense for the args to be in this order.
- - - - -
1 changed file:
- src/code/list.lisp
Changes:
===================================== src/code/list.lisp ===================================== @@ -751,14 +751,17 @@
;; Convert a list to a hashtable. The hashtable does not handle ;; duplicated values in the list. Returns the hashtable. -(defun list-to-hashtable (list test test-not key) +(defun list-to-hashtable (list key test test-not) ;; Don't currently support test-not when converting a list to a hashtable (unless test-not - (let ((hash-test (case test - ((#'eq 'eq) 'eq) - ((#'eql 'eq) 'eql) - ((#'equal 'equal) 'equal) - ((#'equalp 'equalp) 'equalp)))) + (let ((hash-test (let ((test-fn (if (and (symbolp test) + (fboundp test)) + (fdefinition test) + test))) + (cond ((eql test-fn #'eq) 'eq) + ((eql test-fn #'eql) 'eql) + ((eql test-fn #'equal) 'equal) + ((eql test-fn #'equalp) 'equalp))))) (unless hash-test (return-from list-to-hashtable nil)) ;; If the list is too short, the hashtable makes things
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/c09004a15331d191b5dcfe7...