libera/#commonlisp - IRC Chatlog
Search
16:17:42
McParen
hello, does anybody know if there is a function that works like pairlis but produces a plist instead of an alist?
16:18:35
McParen
pairlis intertwines (a b c) and (1 2 3) to ((a . 1)(b . 2)(c . 3)) but I'd like to get (a 1 b 2 c 3).
16:19:00
beach
You can do that easily yourself: (loop for e1 in l1 for e2 in l2 collect e1 collect e2)
16:19:41
McParen
beach, thanks, I've already found out how to do this myself, I am wondering if that is available somewhere as a "standard" function i cant seem to find.
16:24:47
McParen
i was wondering how it was "forgotten" in the standard to provide an alist version but not a plist version.
16:28:28
yitzi
I doubt it was forgotten. PAIRLIS is kind of extraneous in my opinion. If you aren't concatenating an existing alist then it is just MAPCAN with CONS.
16:35:08
phoe
(mapcan #'cons (list (cons 1 2) (cons 3 4)) (list (cons 5 6) (cons 7 8))) produces weird results, as expected of something that forcibly alters CDRs
16:35:38
phoe
no worries, I actually had to stop for a moment and think of what would MAPCAN do with improper lists
16:37:03
yitzi
I am generally of the impression that alists are older and that plists were added later. Initially associated with symbol plists first then disconnected in CL. Anybody attest to that?
16:52:44
yitzi
Looks like plists were added then http://www-formal.stanford.edu/jmc/history/lisp/node4.html
16:55:36
McParen
I grew to like plists more than alists since I realized that you can do (apply #'make-instance 'my-object plist).
17:01:18
_death
it also had a PROP function like (cdr (member ...)) and a REMPROP that assumed a plist structure
17:04:27
_death
lisp 1 also has a simplifier and a differentiator for algebraic expressions.. where did those go? :)
20:33:21
pjb
_death: you can still run lisp 1.5 code in CL. http://informatimago.free.fr./i/develop/lisp/com/informatimago/small-cl-pgms/wang.html
20:39:32
random-jellyfish
is there some open source parser that can translate C++ code to lisp s-expressions e.g. (int main () (printf "Hello World") (return 0)) ?
20:42:51
random-jellyfish
common lisp has powerful pattern matching libs that could be useful for linting
20:44:49
yitzi
I doubt that a CL based linter will be able to determine more info about C++ code than clang ASTs.
20:49:15
random-jellyfish
I'm assuming it would be easier to work with sexpressions in lisp than with some AST structs in C++
20:50:24
an_origamian[m]
Clang is one of the few libraries that can properly parse C++ though. From what I've heard, it's really hard to parse yourself.
20:51:03
an_origamian[m]
And theoretically, you can call Clang from Lisp. Yitzi would know more about that though.
20:52:00
random-jellyfish
yeah, it would be unrealistic and impractical to even try to write a c++ parser from scratch, the standard is thicker than the bible lol
21:07:25
pjb
random-jellyfish: I started a C11 implementation in CL, but I only have cpp, the parser is not done yet. On the other hand, it seems that gilberth in #lispcafe is also working on a C or C++ parser, and he's more advanced.
21:10:45
an_origamian[m]
I'm guessing that's because it says it's probably not for practical coding.