Raymond Toy pushed to branch issue-240-set-diff-with-hash-table at cmucl / cmucl
Commits:
96e66071 by Raymond Toy at 2023-07-26T18:59:10-07:00
Make +min-list-length-for-hashtable+ a defparameter again
Rename it using the `*foo*` convention too. It's super-convenient to
be able to set this for testing, which we do in the existing test
suite for this.
It's also convenient to be able to do this when doing timing tests so
we can compare what happens when the list version is used vs when the
hashtable is used.
- - - - -
7ab5d243 by Raymond Toy at 2023-07-26T19:00:59-07:00
Add some additional tests for set-difference
Add a test where a key is given to make sure that hashtable works
correctly with a key
Add a test where both a test and a test-not is given. This must
signal an error.
- - - - -
2 changed files:
- src/code/list.lisp
- tests/sets.lisp
Changes:
=====================================
src/code/list.lisp
=====================================
@@ -746,7 +746,7 @@
;; The minimum length of a list before we can use a hashtable. This
;; was determined experimentally.
-(defconstant +min-list-length-for-hashtable+
+(defparameter *min-list-length-for-hashtable*
15)
;; Convert a list to a hashtable. The hashtable does not handle
@@ -767,7 +767,7 @@
;; If the list is too short, the hashtable makes things
;; slower. We also need to balance memory usage.
(let ((len (length list)))
- (when (< len +min-list-length-for-hashtable+)
+ (when (< len *min-list-length-for-hashtable*)
(return-from list-to-hashtable nil))
(let ((hashtable (make-hash-table :test hash-test :size len)))
(dolist (item list)
@@ -855,7 +855,7 @@
(cond (hashtable
;; list2 was placed in hash table.
(let ((res nil))
- (dolist (item list1)
+ (doli st (item list1)
(unless (nth-value 1 (gethash (apply-key key item) hashtable))
(push item res)))
res))
=====================================
tests/sets.lisp
=====================================
@@ -72,3 +72,20 @@
(set-difference '("a" "b" "b" "C")
'("c" "D" "e" "f" "g" "h")
:test #'equalp))))
+
+;; Simple test that we handle a key correctly
+(define-test set-diff.hash-eql-with-key
+ (let ((lisp::*min-list-length-for-hashtable* 2))
+ (assert-equal '((3 "b") (2 "b"))
+ (set-difference '((1 "a") (2 "b") (3 "b"))
+ '((1 "a") (4 "c") (5 "d"))
+ :key #'first))))
+
+(define-test set-diff.test-and-test-not
+ (assert-error 'simple-error
+ (set-difference '(1 2)
+ '(3 4)
+ :test 'eql
+ :test-not 'eql)))
+
+
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/3fbae4d018b9bc6891effd…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/3fbae4d018b9bc6891effd…
You're receiving this email because of your account on gitlab.common-lisp.net.
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/c09004a15331d191b5dcfe…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/c09004a15331d191b5dcfe…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-240-set-diff-with-hash-table at cmucl / cmucl
Commits:
c09004a1 by Raymond Toy at 2023-07-26T14:34:09-07:00
Make min-list-length-for-hashtable a defconstant
Update name to use `+foo+` convention for constants.
- - - - -
1 changed file:
- src/code/list.lisp
Changes:
=====================================
src/code/list.lisp
=====================================
@@ -744,8 +744,9 @@
list
(cons item list)))
-;; The minimum length of a list before we can use a hashtable
-(defparameter *min-list-length-for-hashtable*
+;; The minimum length of a list before we can use a hashtable. This
+;; was determined experimentally.
+(defconstant +min-list-length-for-hashtable+
15)
;; Convert a list to a hashtable. The hashtable does not handle
@@ -763,7 +764,7 @@
;; If the list is too short, the hashtable makes things
;; slower. We also need to balance memory usage.
(let ((len (length list)))
- (when (< len *min-list-length-for-hashtable*)
+ (when (< len +min-list-length-for-hashtable+)
(return-from list-to-hashtable nil))
(let ((hashtable (make-hash-table :test hash-test :size len)))
(dolist (item list)
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/c09004a15331d191b5dcfe7…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/c09004a15331d191b5dcfe7…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
3e8b0a12 by Raymond Toy at 2023-07-26T13:43:15+00:00
Fix #245: Replace egrep with grep -E
- - - - -
24152f4d by Raymond Toy at 2023-07-26T13:43:15+00:00
Merge branch 'issue-245-replace-egrep-with-grep' into 'master'
Fix #245: Replace egrep with grep -E
Closes #245
See merge request cmucl/cmucl!158
- - - - -
2 changed files:
- bin/clean-target.sh
- bin/make-extra-dist.sh
Changes:
=====================================
bin/clean-target.sh
=====================================
@@ -48,10 +48,10 @@ CORE='-o -name "*.core"'
if [ -n "$KEEP" ]; then
case $KEEP in
- lib) GREP='egrep -v'
+ lib) GREP='grep -Ev'
PATTERN='(gray-streams|gray-compat|simple-streams|iodefs|external-formats|clx|hemlock|clm)-library' ;;
core) CORE='' ;;
- all) GREP='egrep -v'
+ all) GREP='grep -Ev'
PATTERN='(gray-streams|gray-compat|simple-streams|iodefs|external-formats|clx|hemlock|clm)-library|(asdf|defsystem)'
CORE='' ;;
esac
=====================================
bin/make-extra-dist.sh
=====================================
@@ -94,12 +94,12 @@ install ${GROUP} ${OWNER} -m 0755 $TARGET/motif/server/motifd \
# Install the contrib stuff. Create the directories and then copy the files.
-for d in `(cd src; find contrib -type d -print | egrep -v "CVS|asdf|defsystem")`
+for d in `(cd src; find contrib -type d -print | grep -E -v "CVS|asdf|defsystem")`
do
install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/$d
done
-for f in `(cd src/contrib; find . -type f -print | egrep -v "CVS|asdf|defsystem|unix")`
+for f in `(cd src/contrib; find . -type f -print | grep -E -v "CVS|asdf|defsystem|unix")`
do
FILE=`basename $f`
DIR=`dirname $f`
@@ -108,13 +108,13 @@ done
# Install all the locale data.
-for d in `(cd src/i18n/; find locale -type d -print | egrep -v CVS)`
+for d in `(cd src/i18n/; find locale -type d -print | grep -E -v CVS)`
do
install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/$d
done
# Install mo files.
-for f in `(cd $TARGET/i18n; find locale -type f -print | egrep -v 'CVS|~.*~|.*~')`
+for f in `(cd $TARGET/i18n; find locale -type f -print | grep -E -v 'CVS|~.*~|.*~')`
do
FILE=`basename $f`
DIR=`dirname $f`
@@ -122,7 +122,7 @@ do
done
# Install po files. (Do we really need to distribute the po files?)
-#for f in `(cd $TARGET/i18n; find locale -type f -print | egrep -v 'CVS|~.*~|.*~')`
+#for f in `(cd $TARGET/i18n; find locale -type f -print | grep -E -v 'CVS|~.*~|.*~')`
#do
# FILE=`basename $f`
# DIR=`dirname $f`
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/0411c386ebc48eb35f94e2…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/0411c386ebc48eb35f94e2…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
f577eda6 by Raymond Toy at 2023-07-23T22:38:00+00:00
Fix #244: Add c-call:signed-char
- - - - -
0411c386 by Raymond Toy at 2023-07-23T22:38:01+00:00
Merge branch 'issue-244-c-call-signed-char' into 'master'
Fix #244: Add c-call:signed-char
Closes #244
See merge request cmucl/cmucl!157
- - - - -
2 changed files:
- src/code/c-call.lisp
- src/general-info/release-21f.md
Changes:
=====================================
src/code/c-call.lisp
=====================================
@@ -19,7 +19,7 @@
(intl:textdomain "cmucl")
-(export '(char short int long long-long unsigned-char unsigned-short unsigned-int
+(export '(char short int long long-long signed-char unsigned-char unsigned-short unsigned-int
unsigned-long unsigned-long-long float double c-string void))
@@ -30,6 +30,8 @@
(def-alien-type int (integer 32))
(def-alien-type long (integer #-alpha 32 #+alpha 64))
(def-alien-type long-long (integer 64))
+;; The same as c-call:char, for convenience with C signed-char.
+(def-alien-type signed-char (integer 8))
(def-alien-type unsigned-char (unsigned 8))
(def-alien-type unsigned-short (unsigned 16))
=====================================
src/general-info/release-21f.md
=====================================
@@ -25,6 +25,7 @@ public domain.
* ~~#154~~ piglatin translation does not work anymore
* ~~#171~~ Readably print `(make-pathname :name :unspecfic)`
* ~~#242~~ Fix bug in `alien-funcall` with `c-call:char` as result type
+ * ~~#244~~ Add `c-call:signed-char`
* ~~#248~~ Print MOVS instruction with correct case
* Other changes:
* Improvements to the PCL implementation of CLOS:
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/d5c232939ef12742a7e661…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/d5c232939ef12742a7e661…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-244-c-call-signed-char at cmucl / cmucl
Commits:
a85ad7cf by Raymond Toy at 2023-07-23T12:18:48-07:00
Update release notes with closed issues
Should have been updated when the issue was closed, but we forgot.
Update now.
- - - - -
d5c23293 by Raymond Toy at 2023-07-23T15:07:27-07:00
Update cmucl.pot
Forgot to update cmucl.pot in previous commits/merges that changed
docstrings for various things. Update it now.
- - - - -
8b5c27cd by Raymond Toy at 2023-07-23T15:09:59-07:00
Merge branch 'master' into issue-244-c-call-signed-char
- - - - -
2 changed files:
- src/general-info/release-21f.md
- src/i18n/locale/cmucl.pot
Changes:
=====================================
src/general-info/release-21f.md
=====================================
@@ -23,8 +23,10 @@ public domain.
* Bug fixes:
* Gitlab tickets:
* ~~#154~~ piglatin translation does not work anymore
- * ~~#248~~ Print `MOVS` instruction with correct case
+ * ~~#171~~ Readably print `(make-pathname :name :unspecfic)`
+ * ~~#242~~ Fix bug in `alien-funcall` with `c-call:char` as result type
* ~~#244~~ Add `c-call:signed-char`
+ * ~~#248~~ Print MOVS instruction with correct case
* Other changes:
* Improvements to the PCL implementation of CLOS:
* Changes to building procedure:
=====================================
src/i18n/locale/cmucl.pot
=====================================
@@ -1593,8 +1593,8 @@ msgstr ""
msgid ""
"Returns T if X and Y are EQL or if they are structured components\n"
" whose elements are EQUAL. Strings and bit-vectors are EQUAL if they\n"
-" are the same length and have indentical components. Other arrays must be\n"
-" EQ to be EQUAL."
+" are the same length and have identical components. Other arrays\n"
+" must be EQ to be EQUAL."
msgstr ""
#: src/code/pred.lisp
@@ -9148,6 +9148,12 @@ msgstr ""
msgid "~&Could not find external format ~S~%"
msgstr ""
+#: src/code/extfmts.lisp
+msgid ""
+"List of external formats that are builtin so that they don't need to\n"
+" be loaded on first use."
+msgstr ""
+
#: src/code/extfmts.lisp
msgid "External-format aliasing depth exceeded."
msgstr ""
@@ -9288,6 +9294,13 @@ msgid ""
"replacement character."
msgstr ""
+#: src/code/extfmts.lisp
+msgid ""
+"US ASCII 7-bit encoding. Illegal input sequences are replaced with\n"
+"the Unicode replacment character. Illegal output characters are\n"
+"replaced with a question mark."
+msgstr ""
+
#: src/code/fd-stream.lisp
msgid ""
"List of available buffers. Each buffer is an sap pointing to\n"
@@ -21325,12 +21338,6 @@ msgstr ""
msgid " Gray Streams Protocol Support"
msgstr ""
-msgid ""
-"US ASCII 7-bit encoding. Illegal input sequences are replaced with\n"
-"the Unicode replacment character. Illegal output characters are\n"
-"replaced with a question mark."
-msgstr ""
-
msgid ""
"MAC-ROMAN is an 8-bit character encoding for Western European\n"
"languages including English.\n"
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/f348f645dc3dd3e80f722f…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/f348f645dc3dd3e80f722f…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
d5c23293 by Raymond Toy at 2023-07-23T15:07:27-07:00
Update cmucl.pot
Forgot to update cmucl.pot in previous commits/merges that changed
docstrings for various things. Update it now.
- - - - -
1 changed file:
- src/i18n/locale/cmucl.pot
Changes:
=====================================
src/i18n/locale/cmucl.pot
=====================================
@@ -1593,8 +1593,8 @@ msgstr ""
msgid ""
"Returns T if X and Y are EQL or if they are structured components\n"
" whose elements are EQUAL. Strings and bit-vectors are EQUAL if they\n"
-" are the same length and have indentical components. Other arrays must be\n"
-" EQ to be EQUAL."
+" are the same length and have identical components. Other arrays\n"
+" must be EQ to be EQUAL."
msgstr ""
#: src/code/pred.lisp
@@ -9148,6 +9148,12 @@ msgstr ""
msgid "~&Could not find external format ~S~%"
msgstr ""
+#: src/code/extfmts.lisp
+msgid ""
+"List of external formats that are builtin so that they don't need to\n"
+" be loaded on first use."
+msgstr ""
+
#: src/code/extfmts.lisp
msgid "External-format aliasing depth exceeded."
msgstr ""
@@ -9288,6 +9294,13 @@ msgid ""
"replacement character."
msgstr ""
+#: src/code/extfmts.lisp
+msgid ""
+"US ASCII 7-bit encoding. Illegal input sequences are replaced with\n"
+"the Unicode replacment character. Illegal output characters are\n"
+"replaced with a question mark."
+msgstr ""
+
#: src/code/fd-stream.lisp
msgid ""
"List of available buffers. Each buffer is an sap pointing to\n"
@@ -21325,12 +21338,6 @@ msgstr ""
msgid " Gray Streams Protocol Support"
msgstr ""
-msgid ""
-"US ASCII 7-bit encoding. Illegal input sequences are replaced with\n"
-"the Unicode replacment character. Illegal output characters are\n"
-"replaced with a question mark."
-msgstr ""
-
msgid ""
"MAC-ROMAN is an 8-bit character encoding for Western European\n"
"languages including English.\n"
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/d5c232939ef12742a7e6611…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/d5c232939ef12742a7e6611…
You're receiving this email because of your account on gitlab.common-lisp.net.