• re: Advice for a new lisper

    From B. Pym@21:1/5 to Kenny Tilton on Sun Jul 14 09:57:50 2024
    Kenny Tilton wrote:

    (defun straightp (hand)
    (if (null (cdr hand))
    t
    (and (= (caar hand) (- (caadr hand) 1)) (straightp (cdr hand)))))

    Not bad, except of course for the caar/caadr thing. Lisniks have an irrational bias against recursion where iteration will do, so if they
    turn on you just come back with:

    (loop for (c1 c2) on hand
    unless c2 return t
    unless <in order> return nil)

    Gauche Scheme

    ;; Not a fully functional procedure; just for testing.
    (define (in-order a b) (= 1 (- b a)))

    (define (straight? hand)
    (every
    in-order
    hand
    (cdr hand)))

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