[plt-scheme] Passing procedures are parameters.

From: aditya shukla (adityashukla1983 at gmail.com)
Date: Mon Feb 2 19:44:30 EST 2009

Hello guys , i am new to scheme and still learning to think in the
procedural way.I have a question.Is there a way to pass  a predicate as a
parameter .for example
(
every? predicate lst) returns #f if any element of lst fails to
satisfy predicate, and returns #t otherwise.

> (every? number? '(a b c 3 e))
#f
> (every? number? '(1 2 3 5 4))
#t

I can use map and check is the elements in the list are numbers .But what if
i have to check for any other predicate.I mean can this be generalized.

Aditya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090202/53713d00/attachment.html>

Posted on the users mailing list.