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?