Raymond Toy pushed to branch issue-240-set-diff-with-hash-table at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/code/list.lisp
    ... ... @@ -751,14 +751,17 @@
    751 751
     
    
    752 752
     ;; Convert a list to a hashtable.  The hashtable does not handle
    
    753 753
     ;; duplicated values in the list.  Returns the hashtable.
    
    754
    -(defun list-to-hashtable (list test test-not key)
    
    754
    +(defun list-to-hashtable (list key test test-not)
    
    755 755
       ;; Don't currently support test-not when converting a list to a hashtable
    
    756 756
       (unless test-not
    
    757
    -    (let ((hash-test (case test
    
    758
    -			 ((#'eq 'eq) 'eq)
    
    759
    -			 ((#'eql 'eq) 'eql)
    
    760
    -			 ((#'equal 'equal) 'equal)
    
    761
    -			 ((#'equalp 'equalp) 'equalp))))
    
    757
    +    (let ((hash-test (let ((test-fn (if (and (symbolp test)
    
    758
    +                                             (fboundp test))
    
    759
    +                                        (fdefinition test)
    
    760
    +                                        test)))
    
    761
    +                       (cond ((eql test-fn #'eq) 'eq)
    
    762
    +                             ((eql test-fn #'eql) 'eql)
    
    763
    +                             ((eql test-fn #'equal) 'equal)
    
    764
    +                             ((eql test-fn #'equalp) 'equalp)))))
    
    762 765
           (unless hash-test
    
    763 766
     	(return-from list-to-hashtable nil))
    
    764 767
           ;; If the list is too short, the hashtable makes things