about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-01-29T00·03+0000
committerVincent Ambo <tazjin@google.com>2020-01-29T00·03+0000
commitb0b52255bdad06a3ed6e807ca7aeb5930f1ec450 (patch)
treeed6d09e222ab19ec7b3f99fa2d7411d9f7bc169c
parent0001dfd7f6e1d2c782d80c49d3148408287af8d4 (diff)
fix(fun/wcl): Use 'eql' for byte comparisons r/472
The fact that this works is just an implementation-specific detail. In
theory, 'eq' will only compare object instance equality and not value.

Thanks to /u/patrec from HN for pointing this out.
-rw-r--r--fun/wcl/wc.lisp8
1 files changed, 4 insertions, 4 deletions
diff --git a/fun/wcl/wc.lisp b/fun/wcl/wc.lisp
index a3d5cd120629..81576d41aa4c 100644
--- a/fun/wcl/wc.lisp
+++ b/fun/wcl/wc.lisp
@@ -12,7 +12,7 @@
       (iter
         (for byte in-stream file-stream using #'read-byte)
         (for previous-byte previous byte)
-        (for is-newline = (eq newline byte))
+        (for is-newline = (eql newline byte))
 
         ;; Count each byte
         (sum 1 into bytes)
@@ -22,12 +22,12 @@
 
         ;; Count every "word", unless the preceding character already
         ;; was a space or we are at the beginning of the file.
-        (when (or (eq space previous-byte)
-                  (eq newline previous-byte)
+        (when (or (eql space previous-byte)
+                  (eql newline previous-byte)
                   (not previous-byte))
           (next-iteration))
 
-        (counting (or is-newline (eq space byte))
+        (counting (or is-newline (eql space byte))
                   into words)
 
         (declare (fixnum bytes newlines words))