Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
18
Task/General-FizzBuzz/Maxima/general-fizzbuzz.maxima
Normal file
18
Task/General-FizzBuzz/Maxima/general-fizzbuzz.maxima
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
srep(n, s) := block(
|
||||
l: charlist(s),
|
||||
lrep: map(lambda([c], smake(n, c)), l),
|
||||
apply(sconcat, lrep)
|
||||
)$
|
||||
|
||||
srep_zip(nums, strings) := block(
|
||||
len: min(length(nums), length(strings)),
|
||||
makelist(srep(nums[i], strings[i]), i, 1, len)
|
||||
)$
|
||||
|
||||
genfizzbuzz(factors, words, n1, n2) := for i from n1 thru n2 do(
|
||||
flags: map(lambda([k], charfun(mod(i, k)=0)), factors),
|
||||
if member(1, flags) then sprint(apply(sconcat, srep_zip(flags, words))) else sprint(i),
|
||||
if mod(i-n1+1, 10)=0 then newline()
|
||||
)$
|
||||
|
||||
genfizzbuzz([3, 5, 7], ["Fizz", "Buzz", "Baxx"], 1, 105);
|
||||
Loading…
Add table
Add a link
Reference in a new issue