• re: lisp newbie here

    From B. Pym@21:1/5 to Alex Mizrahi on Sun Jul 14 09:41:55 2024
    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)]))

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)