(s)
return Stream(s.first, compute_rest)
求素数
求素数
求素数
def primes(s):
    """求素数"""
    def not_div(x):
        return x % s.first != 0
    def compute_rest():
        return primes(filter_stream(not_div, s.rest))
    return Stream(s.first, compute_rest)
def primes ( s ) : def not_div ( x ) : return x % s . first != 0 def compute_rest ( ) : return primes ( filter_stream ( not_div , s . rest ) ) return Stream ( s . first , compute_rest )