| Deutsch English Français Italiano |
|
<v706gv$3a5o$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "B. Pym" <Nobody447095@here-nor-there.org>
Newsgroups: comp.lang.lisp
Subject: re: lisp newbie here
Date: Sun, 14 Jul 2024 09:41:55 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <v706gv$3a5o$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Sun, 14 Jul 2024 11:41:56 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="2af9a93e51c2354c9c01f27f8d2b9bf3";
logging-data="108728"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9h9f6GRHMKHF5OF85nwcu"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:+9BJR9v+qXsWRWXXliR9tNeXeBw=
Bytes: 1437
Alex Mizrahi wrote:
> in kmrcl package you can find such implementations:
>
> (defun alist-plist (alist)
> (apply #'append (mapcar #'(lambda (x) (list (car x) (cdr x))) alist)))
Did you see the idiocy?
#'(lambda
Lambda is a macro that expands to (function (lambda ...)).
Users of CL are extremely eager to produce the
ugliest code possible.
Gauche Scheme
(define (alist->plist alist)
(append-map
list
(map car alist)
(map cdr alist)))
Another way:
(use util.match)
(define (alist->plist alist)
(match alist
[((k . v) ...)
(append-map list k v)]))