[plt-scheme] Passing procedures are parameters.

aditya shukla adityashukla1983 at gmail.com
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://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090202/53713d00/attachment.htm


More information about the plt-scheme mailing list