Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
25
Task/FizzBuzz/8th/fizzbuzz.8th
Normal file
25
Task/FizzBuzz/8th/fizzbuzz.8th
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
with: n
|
||||
|
||||
: num? \ n f -- )
|
||||
if drop else . then ;
|
||||
|
||||
\ is m mod n 0? leave the result twice on the stack
|
||||
: div? \ m n -- f f
|
||||
mod 0 = dup ;
|
||||
|
||||
: fizz? \ n -- n f
|
||||
dup 3
|
||||
div? if "Fizz" . then ;
|
||||
|
||||
: buzz? \ n f -- n f
|
||||
over 5
|
||||
div? if "Buzz" . then or ;
|
||||
|
||||
\ print a message as appropriate for the given number:
|
||||
: fizzbuzz \ n --
|
||||
fizz? buzz? num?
|
||||
space ;
|
||||
|
||||
\ iterate from 1 to 100:
|
||||
' fizzbuzz 1 100 loop
|
||||
cr bye
|
||||
Loading…
Add table
Add a link
Reference in a new issue