This is the ideal fizzbuzz. You may not like it, but this is what peak extensibility looks like:(: fizzbuzz (fixnum (list-of (list fixnum symbol)) -> boolean))
(define (fizzbuzz limit conds)
(letrec ((itr (lambda (n)
(if (> n limit)
#t
(begin (let ((unfizzed? (foldl (lambda (acc x)
(if (= 0 (modulo n (car x)))
(begin (display (cadr x))
#f)
acc))
#t
conds)))
(if unfizzed?
(display n)))
(newline)
(itr (fx+ 1 n)))))))
(itr 1)))#;> (fizzbuzz 21 '((3 fizz)(5 buzz)(7 bob)))
1
2
fizz
4
buzz
fizz
bob
8
fizz
buzz
11
fizz
13
bob
fizzbuzz
16
17
fizz
19
buzz
fizzbob
#t
>>62417800
You're really gonna do this, aren't you?
>>62417984
Do what?
Show me a better fizzbuzz algorithm.
>>62417998
fucking newfag brainlets
>>62418053
whats that cute font
>>62418053
Can you extend it to handle other cases at runtime?
>>62417800
Cleaner, if slightly less performant:(define (fizzbuzz limit conds)
(for-each (lambda (n)
(let ((unfizzed? (foldl (lambda (acc x)
(if (= 0 (modulo n (car x)))
(begin (display (cadr x))
#f)
acc))
#t
conds)))
(if unfizzed?
(display n)))
(newline))
(iota limit 1)))
>>62418179
>performant
not a real word pajeet
>>62418188
Answer my question
>>62418217
What's your question again?
>>62418236
Can you extend >>62418053 to handle other cases at runtime?
It looks like your conditions are hardcoded into the function definition, just like any C imperative code monkey would do. What about fizzbaz? fizzbar? buzzbob?
>>62418268
Also having a separate case for "FizzBuzz" is silly
>>62418188
>not a real word pajeet
https://en.wiktionary.org/wiki/performant
Hilarious projection there, subhuman.
>>62418290
>a dictionary anybody can edit!
lol
>>62418465
Answer my question
>>62418489
You asked for a fizzbuzz but it's obvious how you can extend it if you can read the code.
Can you read the code, brainlet Pajeet?
>>62418465
>He didn't read the quotations
Lel, you are below subhuman, in fact using the word human to describe you would be an insult to the rest of humanity.
You are just trash.
>>62418531
>at runtime
>>62418531
You still didn't explain why you have an explicit case for 'FizzBuzz' either. That's just sad.
bampu pantsu
div5(X) :- 0 is X mod 5.
div3(X) :- 0 is X mod 3.
fizzbuzz(X, Max) :- (div3(X), div5(X), writeln('FizzBuzz');
div5(X), writeln('Buzz');
div3(X), writeln('Fizz');
writeln(X)), !,
X < Max,
X1 is X+1,
fizzbuzz(X1, Max).
fizzbuzz :- fizzbuzz(1, 100).
>>62420619
>separate condition for 'fizzbuzz'
ummm try again sweetie
>>62420679
>>62418590
This is you, right? It was just something stupid I put together in a language not meant at all for shit like fizz buzz. But it's real cool how you think you're a hotshot coder cause you only write optimal fizzbuzzes. You must be able to get any job you want, 300k starting.
>>62420690
You sound mad honey. Hit the books and come back to us when your ready...
>>62417800
Please DO NOT post my wife, Ritsu, on this FAGGOT webpage. Thanks.
up