How can I filter null values from this list?
问题 I have the following procedure for creating all prime-pairs in a list: (define (prime-pairs lst) (define (split lst pos) (list (drop-right lst pos) (take-right lst pos))) (define (prime-pairs-iter n acc) (cond ((= n 0) (filter (lambda (e) (not (null? e))) acc)) (else (prime-pairs-iter (- n 1) (let ((s (split lst n))) (if (and (prime? (list->number (car s))) (prime? (list->number (cadr s)))) (append s acc) acc)))))) (prime-pairs-iter (- (length lst) 1) '())) (Full code: https://gist.github.com