Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/FizzBuzz/REBOL/fizzbuzz-1.rebol
Normal file
18
Task/FizzBuzz/REBOL/fizzbuzz-1.rebol
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
REBOL [
|
||||
Title: "FizzBuzz"
|
||||
URL: http://rosettacode.org/wiki/FizzBuzz
|
||||
]
|
||||
|
||||
; Concatenative. Note use of 'case/all' construct to evaluate all
|
||||
; conditions. I use 'copy' to allocate a new string each time through
|
||||
; the loop -- otherwise 'x' would get very long...
|
||||
|
||||
repeat i 100 [
|
||||
x: copy ""
|
||||
case/all [
|
||||
0 = mod i 3 [append x "Fizz"]
|
||||
0 = mod i 5 [append x "Buzz"]
|
||||
"" = x [x: mold i]
|
||||
]
|
||||
print x
|
||||
]
|
||||
7
Task/FizzBuzz/REBOL/fizzbuzz-2.rebol
Normal file
7
Task/FizzBuzz/REBOL/fizzbuzz-2.rebol
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
repeat i 100 [
|
||||
print switch/default 0 compose [
|
||||
(mod i 15) ["fizzbuzz"]
|
||||
(mod i 3) ["fizz"]
|
||||
(mod i 5) ["buzz"]
|
||||
][i]
|
||||
]
|
||||
1
Task/FizzBuzz/REBOL/fizzbuzz-3.rebol
Normal file
1
Task/FizzBuzz/REBOL/fizzbuzz-3.rebol
Normal file
|
|
@ -0,0 +1 @@
|
|||
repeat i 100[j:""if i // 3 = 0[j:"fizz"]if i // 5 = 0[j: join j"buzz"]if""= j[j: i]print j]
|
||||
4
Task/FizzBuzz/REBOL/fizzbuzz-4.rebol
Normal file
4
Task/FizzBuzz/REBOL/fizzbuzz-4.rebol
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
m: func [i d] [0 = mod i d]
|
||||
spick: func [t x y][either any [not t "" = t][y][x]]
|
||||
zz: func [i] [rejoin [spick m i 3 "Fizz" "" spick m i 5 "Buzz" ""]]
|
||||
repeat i 100 [print spick z: zz i z i]
|
||||
Loading…
Add table
Add a link
Reference in a new issue