How can write a program in scheme to find factors of a list of numbers
问题 This is the code for a single integer, how can it extends to list of function? (define (factors n) (define (*factors d) (cond ((> d n) (list)) ((= (modulo n d) 0) (cons d (*factors (+ d 1)))) (else (*factors (+ d 1))))) (*factors 1)) (display (factors 1111111)) (newline) 回答1: You can use for-each to iterate over a list. (define (factors n) (define (*factors d) (cond ((> d n) (list)) ((= (modulo n d) 0) (cons d (*factors (+ d 1)))) (else (*factors (+ d 1))))) (*factors 1)) (define arbitarily