« LISPing Avery Brooks | Home | mission accomplished »

March 7, 2008

my brain hurts

count2 p l = foldr (\x c -> if p x then c+1 else c) 0 l

this (obviously) returns the number of items in list "l" which satisfy predicate "p".

at the time of this writing, i can even understand how.

Leave a comment

About this Entry

This page contains a single entry by sainttoad published on March 7, 2008 5:23 PM.

LISPing Avery Brooks was the previous entry in this blog.

mission accomplished is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.