Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

lisp newbie here

12 views
Skip to first unread message

Robert L.

unread,
May 17, 2018, 6:40:33 PM5/17/18
to
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)))


(define (alist->plist alist)
(match alist
[`((,k . ,v) ...)
(append-map list k v)]))

> (alist->plist '((b . 3)(c . 4)(d . 6)))
'(b 3 c 4 d 6)
> (alist->plist '((b . 3)(c 4 5)(d . 6)))
'(b 3 c (4 5) d 6)


--
"They created ... an America which is not the real America ... but ultimately
this shadow America becomes ... so widely disseminated that its images and its
values come to devour the real America. And so the grand irony of all of
Hollywood is that Americans come to define themselves by the shadow of
America...." http://archive.org/details/nolies
0 new messages