Handbook
Glossary
count= ( ... seq quot: ( ... elt -- ... ? ) n -- ... ? )
Vocabulary
sequences
.
extras
Inputs
seq
a
sequence
quot
a
quotation
n
an
integer
Outputs
?
a
boolean
Word description
Returns
t
if the sequence has exactly
n
elements where
quot
returns true, otherwise returns
f
.
Definition
USING:
kernel
math
sequences
;
IN:
sequences.extras
:
count=
( ... seq quot: ( ... elt -- ... ? ) n -- ... ? )
[
0
]
3dip
[
[
[
[
swap
]
]
dip
[
dip
swap
[
1
+
]
when
dup
]
curry
compose
]
dip
[
>
]
curry
compose
find
2drop
]
keep
=
;
inline