• Re: which articles are sold?

    From B. Pym@21:1/5 to Lieven Marchand on Mon Jun 23 08:53:21 2025
    Lieven Marchand wrote:

    if we have this list:
    (a <sold> b c d <sold> e f g <sold>)
    that shows that article a, d and g are sold and the rest are not how
    can we put all the sold articles in one list:
    (a d g)

    More homework?

    (loop for (first next) on '(a <sold> b c d <sold> e f g <sold>)
    when (eql next '<sold>)
    collect first)

    Scheme:

    (define items '(a <sold> b c d <sold> e f g <sold> h i <sold>))

    (filter-map
    (lambda(x y) (and (eq? '<sold> y) x))
    items
    (cdr items))


    (a d g i)

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