freenode/lisp - IRC Chatlog
Search
11:01:54
xificurC
I got lost in reasoning about a double backticked form. What would be a good resource to read about how backquote is processed? If there was a part about double backquotes or macro-writing-macros that would be even better
11:02:21
no-defun-allowed
I think the cl-d protocol is sussed out now. I've finished an event loop macro and I'm going to write all the cl-d primitive requests tomorrow.
11:08:17
no-defun-allowed
cl-decentralise's event-loop uses a make-event which matches the event forms and e-l simply loops over with some gensyms too.
11:25:35
splittist
xificurC: you can also read Appendix C of CLtL2 https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node367.html#BACKQUOTESIMULATOR
11:25:43
makomo
it's part of my personal notes, i.e. i don't have a blog, but i might rework it a bit and send it
11:26:16
makomo
xificurC: it becomes really simple once you start to see the "patterns" imo. it's just like any other concept really
11:28:02
makomo
xificurC: oh, perhaps also take a look at the two comments i posted here: https://www.reddit.com/r/learnlisp/comments/98gssu/sbcl_inserting_comma_in_macro_transformation/
11:28:30
makomo
they might not be 100% precise, but i tried my best. suggestions welcome. :-) it's not meant to be a tutorial on backquote though, but i did mention some general techniques/things
11:32:59
makomo
xificurC: also, take a look at Bawden's paper https://web.archive.org/web/20170701182144/http://repository.readscheme.org/ftp/papers/pepm99/bawden.pdf . it mentions a funny anecdote about steele as well :-)
11:40:59
makomo
xificurC: after you start to understand it better (or perhaps you can do it in parallel), i would recommend studying ONCE-ONLY (i prefer Alexandria's version to the one found in PCL) https://github.com/keithj/alexandria/blob/master/macros.lisp#L30
12:51:17
russellw
http://www.lispworks.com/documentation/lw61/CLHS/Body/f_coerce.htm#coerce doesn't explicitly say you can coerce a list of characters to a string, but one of the examples implies it, and it works in SBCL. Is it something that can be relied on, in portable code?
12:52:17
beach
russellw: A string is a vector of characters, and it is possible to coerce a list to a vector.
12:53:45
russellw
ah! so the part about sequences, is intended to imply that, if one knows about the relationship between the kinds of vectors? Okay, thanks!
14:31:54
paule32
*** - SETQ: '(GENITIV '(DES BAKTERIUMS '(DER BAKTERIEN)) (SUBSTANTIV SÄCHLICH LEBEWESEN)) is no symbol.
14:32:47
Bike
you've been around here what, two years? you need to seriously reevaluate your process.
15:32:15
Demosthenex
_death: so i found the mailbox lib, which defines a simple object for locked inter-thread communication
15:38:12
dim
Shinmera: re (coerce "/" 'character), see https://github.com/dimitri/pgloader/issues/835#issuecomment-421627350 where I've been using (aref ... 0) instead, because I'm not exposing reader macrology in pglaoder's command language
16:03:24
beach
I mean, if, while running your application, you run out of space in one generation and the GC is disabled, then the system will fail. And if you don't run out of space, then the GC won't run.
16:24:18
AeroNotix
hmm, well there goes that theory. I was trying to see why two threads operating on two different hardware memory transactions were occasionally failing
16:32:37
AeroNotix
shka_: Well, it's more a case of how RTM behaves on the cpu, rather than anything intrinsic to SBCL it seems
16:36:35
Demosthenex
if i create a thread in a let inside a function, when i leave the let scope is the thread killed?
16:51:41
Demosthenex
_death: https://bpaste.net/show/5db6bd9c1964 i've been able to get async input working with other screen updates going
16:52:09
Demosthenex
i'm deliberately moving it, and also trying to protect and restore the position
16:55:09
Demosthenex
AeroNotix: that's a good thought, but it spends 99% of its time sleeping, and its a POC by a noob ;]
16:56:11
AeroNotix
Demosthenex: I prefer using a different method of thread synchronization: channels
16:57:01
pjb
Demosthenex: you could use a global special variable, but there's no guarantee that they're writable atomically.
16:57:44
Demosthenex
pjb: if i make a var, it's just to be checked before the next loop (ie: (loop until *quit* do ....)
16:58:28
AeroNotix
I mention thread-safe just so it's clear that it should be thread safe, setting a variable *should* be fine, without explicit locking but ymmv. I'm not clear on whether setf is atomic.
17:02:39
Demosthenex
https://bpaste.net/show/668b79f059a3 added your global, and now cursor preserves
17:14:37
whartung
even if the global write is atomic, doesn’t mean the other threads will see the change due to caching on the cores.
17:25:49
jackdaniel
looking at the article https://spcl.inf.ethz.ch/Publications/.pdf/atomic-bench.pdf I see 30x penalty
17:26:32
jackdaniel
I don't have opinion what is a good solution because I didn't read the whole backlog
17:28:05
pjb
That said, it's true that you can often merge locks, but it would increase parallelism to keep one lock per data, if they're independent.
17:29:18
AeroNotix
not entirely an expert but you can try to use transactional memory with more coarse grained locks and let the cpu figure out chances for data parallelism
17:29:32
pjb
Demosthenex: for example, you are trying to access a unique resource, the screen. Instead of accessing it from multiple threads, have a single thread own it and access it, and multiple threads communicating with this screen management thread. This can be more efficient, since the screen management thread can then serialize and optimize the requests, and those requests can be built in parallel my the other threads.
17:30:22
AeroNotix
There's a few reasonably decent actor libraries that abstract this kind of interface
17:33:02
AeroNotix
well I've used LFE and Erlang extensively, I dunno, I feel like I understand them both well enough to say whether they bring anything useful to the table
17:36:51
AeroNotix
Just that erlang is "dayjob" stuff and if I have free time I'd prefer to spend it with CL
17:38:22
AeroNotix
I don't think this behaviour is only visible with stmx, it may be just a quirk of how rtm works. I've got a single threaded loop that continually sets a variable to a random value.
17:38:37
AeroNotix
Despite nothing else (in my code, at least) accessing that variable, sometimes the transaction rolls back.
17:39:06
AeroNotix
I, at first, thought it could be the gc interfering with the variable, tried using sb-sys:without-gcing but it didn't change the behaviour
17:40:00
whartung
also, to highlight pjb’s idea of a single controlling thread, the screen is a spectacularly low bandwidth device. Far cheaper to stuff something on a queue and have the controlling thread update, than to have everyone try it and wait for the screen to update.
17:40:31
whartung
if the controlling thread is using something like curses, it can batch all of the updates in to one hit to the display, something competenig threads potentially can not do
17:43:07
AeroNotix
https://gist.github.com/AeroNotix/fd0d7c4d62ac35ff2095d7bfcd6ab8de here's the code. set-it is a macro cause I've extracted this from a test suite where set-it being a macro makes sense.
17:47:10
pjb
To complement what whartung is saying, you should have a look at how emacs on the terminal does it! You'd be surprised.