Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,19 @@
class FizzBuzz(schema=Hash(<3 Fizz 5 Buzz>...)) {
method filter(this) {
var fb = ''
schema.sort_by {|k,_| k.to_i }.each { |pair|
fb += (pair[0].to_i `divides` this ? pair[1] : '')
}
fb.len > 0 ? fb : this
}
}
 
func GeneralFizzBuzz(upto, schema) {
var ping = FizzBuzz()
if (nil != schema) {
ping.schema = schema.to_hash
}
(1..upto).map {|i| ping.filter(i) }
}
 
GeneralFizzBuzz(20, <3 Fizz 5 Buzz 7 Baxx>).each { .say }