Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,21 @@
USING: assocs combinators.extras io kernel math math.parser
math.ranges prettyprint sequences splitting ;
IN: rosetta-code.general-fizzbuzz
: prompt ( -- str ) ">" write readln ;
: get-factor ( -- seq )
prompt " " split first2 [ string>number ] dip
{ } 2sequence ;
: get-input ( -- assoc n )
prompt string>number [1,b] [ get-factor ] thrice
{ } 3sequence swap ;
: fizzbuzz ( assoc n -- )
swap dupd [ drop swap mod 0 = ] with assoc-filter
dup empty? [ drop . ] [ nip values concat print ] if ;
: main ( -- ) get-input [ fizzbuzz ] with each ;
MAIN: main