freenode/#lisp - IRC Chatlog
Search
6:07:17
no-defun-allowed
I wouldn't be sure they're ready. Don't you know how many lines you have to read?
6:07:24
seok
Previous code I had hanged when it reached the end of output, waiting for the next output
6:08:37
no-defun-allowed
If it closes the output when it's done, (loop for line = (read-line output nil) until (null line) do (write-line line))
6:09:25
no-defun-allowed
Is there really no indication of when the output will be done? No line count or anything?
6:10:36
no-defun-allowed
Great. Maybe then you could try to wait a short time (eg 0.1 second) for a result in that case.
6:11:57
no-defun-allowed
(loop named read-loop do (loop for i = 0 to 10 do (if (listen output) (return) (sleep 0.1) finally (return-from read-loop)) do (write-line (read-line output))) is the best I can think of immediately
6:15:19
no-defun-allowed
The inner sleep loop is so that it doesn't burn CPU cycles waiting for LISTEN.
6:18:25
no-defun-allowed
Not in a tight loop like that. If you have a SLEEP form, the CL system gives up its CPU time so it's more likely the subprocess gets to be run, and in the millions of LISTEN calls the CL process will do, only a few will result in T in your case.
6:38:46
pjb
seok: listen only guarantees one character on the stream. So you can use only read-char, unless you accept to be blocked again.
6:40:35
pjb
seok: and when reading from a file or frmo a terminal, you will probably have buffering from the system or the drivers (eg. line buffering on terminals), listening on a character will stop at the end of the line, so you cannot listen to characters until you type RET in the terminal.
6:41:54
pjb
seok: if the terminal is in raw mode (no buffering), then something like (loop while (listen *terminal-io*) collect (read-char *terminal-io*)) will probably return only one character, since the user cannot type fast enough for listen to return true the second time.
6:42:49
pjb
seok: some timing may also depend on the program and its options. See for example grep --line-buffered
6:44:57
pjb
If you look at the source of slurp-stream-lines, you will see it just loops on read-line.
8:20:37
no-defun-allowed
Would anyone know if Sussman's HACKER program (from his thesis) is available to look at anywhere?
15:24:09
Josh_2
https://www.amazon.co.uk/Let-Over-Lambda-Doug-Hoyte/dp/1435712757/ref=sr_1_1?keywords=let+over+lambda&qid=1564154627&s=gateway&sr=8-1
15:28:28
Bike
the whole book isn't available as an ebook, and they don't sell chapters individually.
15:29:23
Bike
hoyte seems fairly smalltime. you could maybe just email him and ask if he offers a pdf or something you could buy, since he does have some chapters as html
17:28:54
aoeu256
Is this a good place to ask noob questions? I was wondering if using Prolog/Constraint Solvers in Lisp can practically reduce bugs and code size. Also where do I find a collection of macros that can increase productivity, it be nice if there is a collection of inference/static analysis/static test/tracing macros.
17:32:00
remexre
I'm having some trouble with Trivia; I'm trying to create a pattern foo, where both (foo x) and (foo x :bar y) are valid, and where x matches against the baz slot and y matches against the bar slot of objects of the foo class?
17:33:02
remexre
I've got (defpattern (foo x &key y) `(foo :baz ,x :bar ,y)), but this complains about foo not being a defined function (which sure, it isn't, but the trivia docs make it look like this is the correct usage)
17:34:01
warweasle
Hi. Did work last night. I almost have my unequip/equip and unequip/interaction/reequip working.
17:38:57
warweasle
sahara3: You would very much like to eat a large "porque" with a dog from Venezuela?
17:40:07
warweasle
Xach: Unfortunately, no. Not unless I get my lisp interpersonal political sim working.
17:40:21
aoeu256
There was this millionaire guy Paul Graham and he said he used macros to to make his code shorter by a lot / optimize his code. I wonder which Macros he used (other than those he talks about in his book). He talks about as if he knows what what our "highest-level" languages 30-60 years from now will look like.
17:40:53
warweasle
Xach: But if I could get some help rewriting Unreal Engine to lisp...that would be great.
17:41:25
Josh_2
aoeu256: yes, you can do that quite easily if you understand how to write good macros
17:44:06
warweasle
I'm pretty sure our highest language in 30 years will involve grunting like cavemen.
17:44:08
aoeu256
Yeah, but before we get to English well get to something half-way between Lisp and English, and it'd be nice to program in that.
17:47:06
warweasle
We need a way to speak lisp natively. I'm tired of translating ideas from english to lisp.
17:49:23
aoeu256
Hmm infix would be nice in the repl, and then change the infix to lisp especially with pipes(|>).
17:51:22
aoeu256
but sometimes its easier to type something when you can reorder the expressions anyway you want
17:53:24
aoeu256
Like lets say your writing code and you forget you needed a let, but your inside the expression. How do you write the let on the outside?
17:58:37
aoeu256
like lets say you are writing EXPR| and then you figure out you wanted (let (blah) EXPR|) where | is the cursor, or any thing else.
17:59:50
ck_
you type C-M-u to go up the syntax tree, then M-( to wrap the expression in parentheses, then type let ((var binding)...)