freenode/#lisp - IRC Chatlog
Search
7:46:03
fiddlerwoaroof
highlight-parentheses gives a special face to the parens around the current form
7:47:08
fiddlerwoaroof
For a "two newlines" string literal, would people prefer #.(format nil "~%~%") or #.(coerce '(#1=#\newline #1#) 'string)?
7:48:44
aeth
personally, if I'm in a ~%~% situation I usually just TERPRI the second ~% instead, for clarity
8:01:50
fiddlerwoaroof
The problem with quotes is that I need to use one line of vertical space per newline in the string
8:03:28
fiddlerwoaroof
The nice thing about #. is that you can have the reader run arbitrary lisp and put arbitrary objects into the read value.
8:06:38
fiddlerwoaroof
I was wondering if I was missing an obvious way to do this, without adding extra line breaks to my code
8:36:58
fiddlerwoaroof
A little thing I've been working on, to make data manipulation a bit more ergonomic in CL
8:54:12
fiddlerwoaroof
Is there something weird about the bindings of variables in (LOOP FOR VAR IN ...)?
8:57:36
moon-child
if all you're doing is iterating over a single list, it might be easier to mapcar
10:57:51
h4ck3r9696
How do I get started with threading in Common Lisp? I read the CL cookbook's article, but I find it very brief and hard to understand. For example, how do I write to *standard-output* from a thread without getting wierd behavior and duplicating text? I tried to use a lock every time I use format, but that didn't work.
11:05:53
phoe
AFAIR e.g. CCL streams are not threadsafe by default, two streams cannot write to a stream at the same time
11:07:44
beach
You would have to paste your code somewhere. It is not clear what the constellation of threads is.
11:10:36
ck_
and is this the tutorial you mean? https://lispcookbook.github.io/cl-cookbook/process.html (C-f "print a message onto the top level")
11:12:29
ck_
maybe you could compare your settings? I know phoe and beach turn the safety knobs all the way up, for example
11:14:10
Nilby
When a thread flushes the buffer and there's output from the other thread in unflushed in there, it get's double output.
11:15:53
phoe
Nilby: still sounds like a very weird thing if it occurs after (format s ...) (finish-output s)
11:16:27
phoe
I mean, this sounds bugworthy for me - the role of finish-output is meant to flush the stream
11:16:49
phoe
then there should be no double output because the first line should have already been flushed
11:17:07
Nilby
It's just that there's output from multiple threads in there if you don't make multiple stram buffers somehow.
11:19:54
h4ck3r9696
Well, guess i'll have double output. It doesn't really matter anyway because i'll add a GUI soon
11:19:56
Nilby
I experience it all the time since I run stuff directly in a terminal. But it's not hard mitigate. Also, the normal flushing in sbcl &
11:20:29
phoe
in terminal it's normal when multiple threads write to a single stdout without locking
11:28:42
Nilby
This gives pretty random results, and worse when you put a finish-output afger the print: (progn (bt:make-thread (lambda () (dotimes (i 50) (print i) (sleep .1)))) (bt:make-thread (lambda () (dotimes (i 50) (print i) (sleep .1)))))
11:44:46
Nilby
One easy way to have slightly more consistent output is make a new stream per thread, e.g. https://plaster.tymoon.eu/view/2235#2235
11:50:28
Nilby
You can get really messed up if you're a kook like me doing a tui with many threads writing & inputting.
11:58:40
fiddlerwoaroof
Nilby: I contributed https://github.com/slime/slime/blob/master/contrib/slime-buffer-streams.el that might help this sort of problem
11:59:54
fiddlerwoaroof
I don't think it's been ported to sly, but it's a bit cleaner for some things (DRKMA:*HEADER-OUTPUT-STREAM*, for example) than just using *standard-output* for everything
12:10:30
Nilby
fiddlerwoaroof: Thanks. That seems quite useful, especially for network stuff. Interactive terminal stuff must take another path though.
15:05:51
v3ga
hmm, after Common LISP: A Gentle Introduction to Symbolic Computation should I read Let over Lambda or Land of Lisp?
15:06:56
minion
v3ga: please look at PCL: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
15:09:41
v3ga
beach: lol, ok. I have that as well. I actually came across a copy for a good price and grabbed it but I haven't touched it yet.