[REBOL] Re: Re(2): newbie!?
From: lmecir:mbox:vol:cz at: 1-Dec-2000 8:58
Hi,
one possible solution:
; using higher order functions
do http://www.sweb.cz/LMecir/highfun.r
repeated-n?: function [
{find out, if a given value is repeated n times in the series}
series [series!]
n [integer!]
value [any-type!]
] [found] [
found: series
repeat i n [
if not found: find found get/any 'value [break]
found: next found
]
found
]
repeated-n: func [
{find n-times repeated values in a series}
series [series!]
n [integer!]
] [
filter do curry :repeated-n? 2 series n series
]
>> repeated-n [1 2 1 3 1 2] 3
== [1 1 1]
Regards
Ladislav