其他分享
首页 > 其他分享> > scip 练习2.20

scip 练习2.20

作者:互联网

(define (same-parity x . z)
  (define (q? y) (= (remainder y 2) 1))
  (define (o? y) (= (remainder y 2) 0))
  (define (jg z f)
     (define m '())
     (define (je a f m)
       (if (f (car a))
           (append m (list (car a)))
           m))
     (if (null? (cdr z))
         (je z f m)
         (append (je z f m) (jg (cdr z) f))))          
  (if (q? x)
      (append (list x) (jg z q?))
      (append (list x) (jg z o?))))

 

标签:scip,car,练习,list,je,2.20,jg,append,define
来源: https://www.cnblogs.com/hjj-fighting/p/10943374.html