• Re: Speed up interpolation

    From B. Pym@21:1/5 to Rainer Joswig on Tue Aug 12 15:57:09 2025
    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

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