def any(xs): if not xs: return False else: x = head(xs) if x: return True return or_(x, any(tail(xs)))
def all(xs): if not xs: return True else: x = head(xs) if not x: return False return and_(x, all(tail(xs)))
def foldr(f, v, xs): if not xs: return v else: return f(head(xs), foldr(f, v, tail(xs)))
def length(xs): if not xs: return 0 else: return 1 + length(tail(xs))
def reduce(f, xs): if not xs: return 0 else: return f(head(xs), reduce(f, tail(xs)))
def filter(p, xs): if not xs: return [] else: return [head(xs)] + filter(p, tail(xs)) if p(head(xs)) else filter(p, tail(xs))
def map(f, xs): if not xs: return [] else: return [f(head(xs))] + map(f, tail(xs))
def reverse(xs): if not xs: return [] else: return reverse(tail(xs)) + [head(xs)]
def product(xs): if not xs: return 1 else: return head(xs) * product(tail(xs))
def sum(xs): if not xs: return 0 else: return head(xs) + sum(tail(xs))