A function which will determine that if a passed in list follows an A B pattern

前端 未结 3 656
情深已故
情深已故 2021-01-26 19:34
(define fun4

 (lambda ( ls)

(cond ((null? ls ) #f)

 (cons (((eqv? \'a (car ls))) && ((eqv? \'b (cdr ls)))))

(else (pattern2 cdr ls)))))

In

3条回答
  •  Happy的楠姐
    2021-01-26 20:32

    So much wheel reinvention. Just use SRFI 1!

    (require srfi/1)
    (define (fun4 lst)
      (every eq? lst (circular-list 'a 'b)))
    

    (This operates under the assumption that (a b a) should be valid rather than invalid.)

提交回复
热议问题