count_if
parent
2b8dd131fa
commit
84a82606d0
@ -1,3 +1,12 @@
|
||||
#lang racket/base
|
||||
(require racket/list racket/bool)
|
||||
|
||||
(provide (all-defined-out))
|
||||
(provide (all-defined-out))
|
||||
|
||||
(module+ test (require rackunit))
|
||||
|
||||
(define (count_if pred xs)
|
||||
(length (filter-not false? (map pred xs))))
|
||||
|
||||
(module+ test
|
||||
(check-equal? (count_if procedure? (list 42 null max min)) 2))
|
Loading…
Reference in New Issue