Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Good day for overcoming obstacles. Try a steeplechase.


comp / comp.lang.lisp / re: lisp newbie here

SubjectAuthor
o re: lisp newbie hereB. Pym

1
Subject: re: lisp newbie here
From: B. Pym
Newsgroups: comp.lang.lisp
Organization: A noiseless patient Spider
Date: Sun, 14 Jul 2024 09:41 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Nobody447095@here-nor-there.org (B. Pym)
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=
View all headers

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)]))

1

rocksolid light 0.9.8
clearnet tor