freenode/#lisp - IRC Chatlog
Search
14:02:14
beach
didi: In combination with WITHOUT-ERRORS it can be used to write a very simple function for determining whether a list is a proper list.
14:05:05
didi
I'm yet to use an improper list. I can imagine there's an use case for circular lists, but for what would one use a dotted list?
14:05:46
pjb
didi: actually, once I had a case, were I didn't want NIL as the end of the list. IIRC, I had to distinguish two cases for the end of the list.
14:06:09
pjb
But otherwise, it's more often an error, indeed. Hence the use of ENDP and list-length.
14:06:47
pjb
notably, length may do an infinite loop on circular lists, so if you have them, better use list-length (or my list-lengths which gives more info).
14:16:58
jcowan
didi: my implementation of lazy sequences uses improper lists to represent an incompletely materialized sequence, with the generator function in the cdr of the last pair.
14:17:48
jcowan
you can cdr down the already realized values, and when you get to a pair whose cdr is nil then you are done, but if you get a function then you call it and add a new pair.
14:20:08
jcowan
See https://github.com/scheme-requests-for-implementation/srfi-127/blob/master/lseqs/lseqs-impl.scm (in Scheme, but should be readable to any Lisper), specifically the lseq-cdr procedure
14:25:15
jcowan
Scheme returns a dedicated "end-of-file object" when any input function reaches end of file (rather than raising a condition) and I use the same convention for generator functions.
18:02:10
anamorphic
Hmm how would I ensure a text file I write to always produces Unix-style line endings, even on Windows?
18:05:39
jcowan
anamorphic: https://bugs.launchpad.net/sbcl/+bug/310185 suggests that sbcl always writes LF only, even on Windows, though this may have been fixed and not recorded there
19:24:56
solene
hello, is it possible to use a pipe command like echo foo | wc using uiop:run-program?
19:54:13
mrblack
what would be a good lisp project (that is not too hard) for the Linux environment that would solve things lispers need?
19:59:32
aeth
solene: you might want launch-program instead because it has a :stream option for :input and :output (but it's harder to work with because it's async).
20:00:30
solene
aeth: I'm quite happy with run-program, I just wanted to use a list because it prevents errors in passing parameters
20:05:04
mrblack
solene, I had this idea of implementing some of the gnu coreutils because hackability... but I don't know if that makes sense.
20:05:43
aeth
(defun uiop-pipe () (let* ((echo (uiop:launch-program "echo foo" :input :stream :output :stream)) (echo-output (uiop:process-info-output echo)) (wc (uiop:launch-program "wc" :input echo-output :output :stream)) (wc-output (uiop:process-info-output wc))) (loop :for line := (read-line wc-output nil :eof) :until (eql line :eof) :do (write-line line))))
20:19:33
aeth
Even though launch-program is technically async, this sort of resyncs it and makes it basically the same as run-program. run-program doesn't have :stream for some reason, possibly because :stream could hang.
20:26:09
aeth
It looks like these are the potential errors: https://github.com/fare/asdf/blob/b6d2f9b44c047a5e65520692159cab7d3e9e072e/uiop/launch-program.lisp#L507-L532
21:18:36
gendl
but i'm seeing old code where it looks like they expected this kind of thing to work.
21:19:27
gendl
Is anyone familiar with the "metabang.bind" system? I'm looking at code in cl-markdown, which uses metabang.bind:bind, and it's doing this kind of thing and failing
21:21:47
gendl
it's doing (metabang.bind:bind (((a b c nil) (list 1 2 3 4)) ...) ... ) which I assume bubbles down into some kind of multipe-value-bind thing -- and it fails similarly as with mutiple-value-bind but with a slightly different error message.
21:27:26
phoe
"This seems to be what the standard mandates, so conforming code should not be affected."
21:29:31
gendl
Well SBCL is doing its job - non-conforming code should be shaken out of the ecosystem. And that's exactly what's happening right now.
21:30:02
gendl
i'm just not sure whether metabang.bind aims to smooth over this kind of thing or not
21:30:39
gendl
(the thing is, I know how to fix it in cl-markdown, but not in metabang.bind, so my only real option is the former)
21:30:56
phoe
I suggest you open an issue on metabang-bind asking them to clarify and define that behavior.
21:32:22
gendl
I'd like it to work for everyone, not just for my application (in this case the application is the clnet site generator)
21:32:51
phoe
gendl: I think the proper way to make it work for everyone is to ask BIND authors for clarification, and to do what they say.
21:33:18
gendl
I'm gonna do the following: 1. lodge a merge request against cl-markdown, which they can feel free to reject if they can fix it in metabang.bind instead (it happens to be the same author).
21:33:39
gendl
2. Make a local patch in my application with a flag to remove it if/when the issue is fixed in Quicklisp.
21:35:53
gendl
Bike: thanks for tracking down the change in sbcl which explains why it was working before.
21:47:36
montxero
phoe: lol if you mean actually looking in there, I already do that. I just figured there ought to be a way to do it without leaving a the repl
23:32:58
gendl
or better: `(directory (merge-pathnames "dists/quicklisp/installed/systems/" ql:*quicklisp-home*))`