• Re: Speed up interpolation

    From B. Pym@Nobody447095@here-nor-there.org to comp.lang.lisp on Tue Aug 12 15:57:09 2025
    From Newsgroup: comp.lang.lisp

    Rainer Joswig wrote:

    (loop with result = initial-result-value
    for a in list ; map over the list
    when (keep-p a) ; filter out
    do (setf result (reduction-op (op a) result)
    finally (return result))

    for example

    (loop with result = ()


    Wrong.

    () is not a number.

    for a in list
    when (evenp a)
    do (setf result (* (sqrt a) result))
    finally (return result))

    (let ((seq '(2 3 4 5 6)))
    (do ((result 1 (if (evenp x) (* x result) result))
    x)
    ((null seq) result)
    (setf x (pop seq))))

    ===>
    48
    --
    [T]he problem is that lispniks are as cultish as any other devout group and basically fall down frothing at the mouth if they see [heterodoxy].
    --- Kenny Tilton
    The good news is, it's not Lisp that sucks, but Common Lisp. --- Paul Graham --- Synchronet 3.21a-Linux NewsLink 1.2