Handbook
Glossary
(count-numbers) ( remaining first value used max listener: ( -- ) -- ? )
Vocabulary
benchmark
.
beust2
Inputs
remaining
an
object
first
an
object
value
an
object
used
an
object
max
an
object
listener
a
quotation
with stack effect
( -- )
Outputs
?
an
object
Definition
USING:
kernel
math
sequences
;
IN:
benchmark.beust2
::
(count-numbers)
( remaining first value used max listener: ( -- ) -- ? )
10 first
-
<iota>
[|
i |
i first
+
:>
digit digit
2^
:>
mask i value
+
:>
value' used mask
bitand
zero?
[
value max
>
[
t
]
[
remaining 1
<=
[
listener
call
f
]
[
remaining 1
-
0 value' 10
*
used mask
bitor
max listener
(count-numbers)
]
if
]
if
]
[
f
]
if
]
any?
;
inline
recursive