プリミティブ フィルター プロシージャでラムダを使用して、負の奇数整数と正の偶数整数をすべて削除したリストを返すプロシージャを作成しています (文字列は保持できます)。私も再帰の使用を避けていますが、それが私を困惑させています。私がこれまでに持っているものは次のとおりです。
(define (f2b lst)
(cond ((null? lst)'()) ; if the list is empty, return the empty list
((pair? (car lst)) ; if the current element isn't a list
(filter (lambda (x) (or (even? x) (positive? x))) (car lst))
(filter (lambda (x) (or (odd? x) (negative? x))) (car lst)))
(else (string? (car lst)) ;otherwise, if the current element is a string,
(car lst) ; then return that element
(f2b (cdr lst)))))
また、両方のフィルター手順を同時に適用する方法もわかりません。