libera/#commonlisp - IRC Chatlog
Search
12:46:04
gin
is there a data structure to push a key-value pair into an alist where each assoc's car is the key and the cdr is a list of values? if I do (addkv "f" "foo" alist) (addkv "f" "fox" alist) (addkv "b" "bar" alist), I should get alist to be '(("f" . ("foo "fox") ("b" . ("bar")) which is really the same thing as '(("f" "foo" "fox") ("b" "bar"))?
12:46:35
gin
And if I (addkv "f" "frog" alist) to it again, I should get alist to be '(("f" . ("foo "fox" "frog") ("b" . ("bar")). and so on.
12:48:25
pjb
gin: but you need to write your own accessor to deal with the case where the key is not in the alist
12:49:31
gin
beach: but (cdr (assoc key list)) is going to be NIL when the key does not exist yet, so I need to check that and add an empty list to key before I push the value, right?
12:49:51
gin
beach: so I think the idea is to just use an alist and build this little functionality myself.
12:54:38
_death
if I choose to use an alist, very often I have it hold a list of values, even if the length of the list is 1.. this avoid annoying (a . b) syntax
15:19:47
random-nick
hello, I'm trying to write bindings to gtk (and possibly other gnome libraries) by using the girepository library which loads .typelib files from disk (which are a compiled version of .gir files, which are generated by parsing gobject-based library source code and special annotations)
15:21:07
random-nick
so the girepository library has a function which lets you call the introspected functions directly through it
15:22:12
random-nick
but it also gives enough information to be used to generate bindings which have no need for girepository during runtime
15:23:05
random-nick
I think generating cffi bindings is a better approach, but I am not sure how should these bindings get generated
15:24:08
random-nick
I could make it generate the bindings using a macro, which would then mean the finished bindings would be in a compiled fasl without having to load girepository, right?
15:25:04
random-nick
but a problem with that is that a system update could update gtk and render the bindings somehow outdated
15:26:29
random-nick
so should I make it generate the bindings during load time or during macro expansion time?
15:35:24
random-nick
there's also the option of loading girepository, asking it to load the library's typelib, querying the library's major, minor and patch version and then generating a .lisp file containing the bindings, or loading one if it already exists
15:43:30
pjb
random-nick: libraries are versionned too. So if you generate the bindings for libfoo.2.3.4.so, you won't take libfoo.2.4.1.so!
15:44:09
pjb
random-nick: in any case, when you generate a new cffi, you will have to modify your sources!
15:47:51
random-nick
pjb: gtk3's first soversion number has apparently stayed 0 across its lifetime, so the incompatibilities seem to be only in behaviour and new additions
15:49:16
random-nick
also, over the lifetime of one gtk version, there don't seem to be too many incompatibilities encountered by a single program, but I don't know if that might change with gtk4
15:54:15
random-nick
beach: well, I don't really prefer gtk, but there don't seem to be any gtk bindings which are up-to-date and generated with gobject-introspection and gtk is a "native" toolkit for a good chunk of gnu/linux environments
15:56:00
random-nick
I've also briefly looked into the possibility of a mcclim backend for gtk, but it doesn't seem to be feasible because gtk3 is not only not intended to be used by multiple threads at the same time, but it's also not intended to be used by threads other than the one running the main loop
15:59:21
beach
And by "that doesn't sound so great", I mean that it would make it useless for many Common Lisp GUI applications.
16:04:31
random-nick
and I don't really have an answer to your question since I don't really intend to use these gtk bindings for any serious project, and I honestly forgot why was I even looking into the gtk binding situation since it was a year ago
16:09:29
random-nick
oh, also regarding threads, the intended usage of threading in C gtk applications is to do everything GUI-related in initialisation code and in event callbacks, while all other threads are worker threads and send events to the main loop using glib's apis for that (some of glib's apis are thread-safe)
16:54:52
jackdaniel
it is possible to have the port run in main thread and core infrastructure will assure thread safety between frames and the pirt
16:56:08
jackdaniel
that said all ports that require being run in the main tgread would need to cooperate
18:19:37
lisp123
Creates HTML docs very easily (IMO one of the best possible static site generators out there), using only emacs, and for lisp, it will ensure indenting and syntax highlighting transfer over to the html file
18:20:04
lisp123
plus you get all the power of slime/paredit/any other tools you have when workign with code blocks with org
18:32:20
nij-
By a "rofi-like window", I mean an X window that always show up on top of all of the others.