libera/#commonlisp - IRC Chatlog
Search
8:57:37
splittist
ldb: very cool. The tabulated tables (if you see what I mean) on eg labeled pages 558/559 of the pdf are more ragged than the ones on e.g. page 563 of the physical edition. The index is vital to be able to find references to aadvarks and warm fuzzy feeling, for example. (:
14:04:20
nij-
With shell command `cat file > sha1sum` I can get the sha1 of the content of the file. How to do that in CL?
14:14:16
nij-
(sha1:sha1-digest "abc") ;; => (169 153 62 54 71 6 129 106 186 62 37 113 120 80 194 108 156 208 216 157)
14:19:01
scymtym
the ironclad equivalent is (ironclad:byte-array-to-hex-string (ironclad:digest-sequence :sha1 (babel:string-to-octets (format nil "abc~%")))) => "03cfd743661f07975fa2f1220c5194cbaff48451"
14:25:08
nij-
Your example immediately teaches me how to use ironclad, by comparing to a tool that I'm more familiar with :)
15:38:53
splittist
nij-: presumably the first avoids starting a new cat process - the shell is doing the redirection itself
15:42:56
nij-
I'm not sure about apt-install, but I remembered some pain when I relied on pacman for sbcl back then.
16:06:54
pjb
nij-: indeed, cat | sha1sum need to for two processes instead of one, and to create a pipe. In the shell "repl" it doesn't matter much, but in shell scripts this could slow down the script. Furthermore, cat doesn't always copy the file byte-for-byte. It has options to do some formatting.
16:08:27
pjb
somebody could have: alias cat='/bin/cat -s -v' so that when it's used in the terminal to dump a file, adjacent empty lines be squeezed, and control characters printed as ^X. sha1-summing that wouldn't be meaningful.
16:48:42
pjb
One of the atomic type specifiers short-float, single-float, double-float, or long-float, or else some other type specifier defined by the implementation to be acceptable.
17:37:55
pjb
now the funny thing is that ratio gives a double-float result (in ccl), instead of ratio. On the other hand, rational gives a ratio result (in ccl)…