function - How do you get the values greater than a number from a list in scheme? -
how extract , return list numbers greater number found in given list? know how return max different. example (gfifty ‘(a b (c d) 1 56 67 g)) (56 67) in example above, returns list containing values greater 50. teach me master. :)
the idiomatic solution use filter:
(filter (lambda (x) (and (number? x) (> x 50))) '(a b (c d) 1 56 67 g)) => '(56 67) to see how write implementation scratch, take @ this answer. if search recursive (if must search inside sublists), study this other answer.
Comments
Post a Comment