• Re: getting list of keys

    From B. Pym@Nobody447095@here-nor-there.org to comp.lang.lisp,comp.lang.scheme on Wed Jul 2 09:35:42 2025
    From Newsgroup: comp.lang.lisp

    B. Pym wrote:

    an `update' function for the mp3 database.
    I need a function for doing something like this with a list:

    * (xxxx (list :artist "something" :song "sss"))
    (:artist :song)

    Thanks in advance, and sorry for my bad english.
    --
    Pablo.

    CL-USER> (loop :for (x y) :on (list :artist "something" :song "sss") :by #'cddr
    :collect x)
    (:ARTIST :SONG)

    Gauche Scheme and Racket using unfold from SRFI-1.

    (use srfi-1) ;; unfold for Gauche
    or
    (require srfi/1) ;; unfold for Racket

    (unfold null? car cddr '(:artist "something" :song "sss"))
    ===>
    (:artist :song)

    Gauche Scheme

    (use gauche.lazy) ;; lslices

    (map car (lslices '(:artist "something" :song "sss") 2))
    ===>
    (:artist :song)


    --- Synchronet 3.21d-Linux NewsLink 1.2