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.
17:48:54
AeroNotix
Not to mention that it'll subjectively make the code far easier to reason about and understand
17:49:20
AeroNotix
instead of minute instances of locking/unlocking. You would have send-to-screen type operations that don't care how the screen handles that operation
17:49:48
whartung
you still have locking and unlocking, but theyre ideally faster since you’re only fighting over a queue, vs a slow display.
17:50:08
AeroNotix
whartung: indeed, but the individual instances of locking can be abstracted into the "screen" API
18:03:46
Demosthenex
pjb: so the casier demo is just like the mailboxes i'm using, and really i don't need anything deep, i just wanted async input while taking forms data so i can have popup combo boxes display autocompletion options without stopping
18:21:13
pjb
Demosthenex: I don't know. I've got my own mailbox synchronization abstration here: https://framagit.org/patchwork/mclgui/blob/master/mailbox.lisp but it locks the recipient until the sender posts a message.
18:22:04
pjb
So right, this is also the point I wanted to mention: usually, threads will be waiting on a queue or a mailbox like this, to receive a message and process it. So it's natural and easy to define a quit message to have the thread stop.
18:27:26
AeroNotix
btw in the area of self-hosted git sites, check out gitea and gogs. Far superior to gitlab (IMHO!!)
19:40:57
jasom
jackdaniel: Most lisp-in-X are rubbish, mainly because it's relaly easy to make a bad one, but very hard to make a good one.
19:45:35
aeth
I'm having a hard enough time writing Scheme-in-Common-Lisp and Scheme's the closest Lisp to CL that's not Emacs Lisp or essentially obsolete. The hard part is getting the exact semantic match while preserving performance. Pseudoscheme never tried to do this, hence the "pseudo".
19:46:03
jasom
jackdaniel: which part is bold? I think it's relatively intuitive that the larger the distance between the difficulty of doing something poorly and the difficulty of doing something well, the more times something will be done poorly. I know it's easy to do one badly because I have done so.
19:46:24
aeth
I can't imagine doing a Lisp-in-Foo that is not just Foo with s-expressions because the semantic mismatch would be even greater than Scheme-on-CL
19:47:31
plathrop
welll... every language has to be written in another language. So it has to be possible to write good Lisp-in-Foo for *some* values of Foo
19:48:31
plathrop
I'm just being overly pedantic about "doing a Lisp-in-Foo" == "Foo with s-expressions"
19:48:37
jackdaniel
bold, that /most/ are /rubbish/. first suggests you have compared at least a few, second that they are worthless (given some objective(?) metric)
19:49:03
aeth
jackdaniel: It's actually the least bold claim that most $thing_on_the_internet are rubbish
19:50:25
aeth
The problem with bad software is it doesn't (usually) have a test suite to express how bad it is.
19:51:07
jackdaniel
aeth: informal verification fails short: take randomly person from this channel they'll say: python is rubbish; take randomly person from python channel they'll say: lisp is dead ;)
19:51:50
aeth
jackdaniel: People actually can use Python for serious projects, so it's not rubbish in the context here. I would guess that there are thousands and thousands of hobby Lisps and "Lisps" out there and maybe 20-30 are usable.
19:52:57
aeth
The problem is, you'd need to try to write a project in $foo to find out that it's not a usable language implementation sometimes.
19:53:32
aeth
It's very easy to make a Lisp, so I don't think it's controversial that there are many.
19:57:44
jasom
actually we can be fairly certain it's a function, since deftest (in this case) expands to a defun and test-+ is defined with deftest as well
20:13:13
pfdietz
Is there a portable implementation of the Common Lisp reader (in Common Lisp) anywhere? That is, I want to be able to modify it so I don't want to use any CL's builtin reader.
20:16:03
pfdietz
Want I want this for is this: I want to be able to trawl lisp sources for code fragments to use in testing, but I don't want to actually have to load the code, so packages may not be defined. So I want a reader that can skip over package names it doesn't know without completely aborting.
20:20:48
jasom
http://metamodular.com/incremental-parsing.pdf <-- there's the paper I was thinking of, not sure if there is currently useful code
20:24:16
jasom
And here's the code for parsing lisp that that paper is intending to do better than: https://github.com/robert-strandh/Climacs/tree/master/Syntax/Lisp
22:18:52
kenu
I am trying to query db with postmodern's doquery, but it doesnt preserve upper cases in column names
22:22:07
aeth
If it's using symbols it has to assume that the user is probably going to say foo, which gets translated into FOO, and want it to represent "foo". |foo| would be how to get case-sensitivity, but if it assumes upcasing and then downcases it that wouldn't help
22:34:17
jasom
And you definitely can set postmodern:*downcase-symbols* to nil and use '|ColumnName|
22:40:46
jasom
though since most of the forms get expanded a macroexpand time you'll have to be smart about how you set that.