I-is it that time of the day already anons?

i-is it that time of the day already anons?
t-time to post our best fizzbuzz?

pub fn fizzbuzz(range: u64) {
for i in 0..range {
if i % 15 == 0 {
println!("fizzbuzz");
continue;
}
if i % 3 == 0 {
println!("fizz");
continue;
}
if i % 5 == 0 {
println!("buzz");
continue;
}
}
}

Attached: Screenshot 2018-11-06 at 20.27.54.png (296x270, 110K)

>he probably thinks he knows Rust now

t. mad c++let that cant read my code because he is a retarded boomer c++let. do you even know what println!() does? lmao

pub fn fizzbuzz(range: u64) {
for i in 1..range {
match (i % 3, i % 5) {
(0, 0) => println!("fizzbuzz"),
(0, _) => println!("fizz"),
(_, 0) => println!("buzz"),
_ => println!("{}", i),
}
}
}

wtf i love rust now

this is slower and worse than my implementation because match is doing two comparisons by default.

>this is slower and worse than my implementation
It is exactly the same speed as your implementation (when your implementation is corrected to print the number if it isn't divisible by 3 or 5 as per correct fizzbuzz behavior)
Stop trying to outsmart the compiler when you don't even know what you're doing

BTFO

>It is exactly the same speed as your implementation
wrong.

>replying to ur own posts..

BTFO again
T
F
O

boy you suck at logic

Attached: btfo again.png (905x371, 24K)

>wrong
Yours is actually a bit slower, but it's within margin of error so I'm considering them the same.

Attached: Screen Shot 2018-11-10 at 8.39.59 PM.png (488x128, 13K)

let fb = (length, rules) =>
Array.from({ length }).map((_, i) =>
rules.reduce((final, curr) => (final ? final : curr(i + 1)), false)
);

let values = fb(100, [
x => x % 5 == 0 && x % 3 == 0 && "fizzbuzz",
x => x % 5 == 0 && "fizz",
x => x % 3 == 0 && "buzz",
x => x
]);

console.log(values);

console.log([...Array(100)].map((_,i) => i+1).map(i => `${i%3?'':'fizz'}${i%5?'':'buzz'}`||i).join('\n'))

>==

I think this is realistically the most expressive thing you can do in Python 3, ignoring performance
from typing import List, Tuple, Callable
from itertools import count, islice
def fizzbuzz(func: Callable[[int], Tuple[int, int]], nums: List[int]):
for i in nums:
pair = func(i)
if pair == (0,0):
yield 'fizzbuzz'
elif not pair[0]:
yield 'fizz'
elif not pair[1]:
yield 'buzz'
else:
yield i

list(islice(fizzbuzz(lambda i: (i % 3, i % 5), count(1)), 15))

Since when does wrapping simple concepts in pointless abstractions qualify as expressiveness?

it doesn't
that was the point

no matter how fancy and built-in your range, tuples, lazy evaluation, and anonymous functions are, imperative languages have a limit in expressiveness.

Wouldn’t this print an extra “fizz” and “buzz” in the event of ‘n % 15 == 0’ ?

15 satisfies all three of your conditionals and you don’t force the last two to only work if the first of the three already executed through something like an else if statement

continue;

Attached: Screenshot 2018-11-02 at 22.29.52.png (292x270, 109K)

from typing import List, Optional, Callable
from itertools import count, islice
def fizzbuzz(nums: List[int], fizz: Callable[[int], bool], buzz: Callable[[int], Optional[int]]):
for i in nums:
f = 'fizz' if fizz(i) else None
b = 'buzz' if buzz(i) else None
yield (f,b) if any((f, b)) else i

list(islice((fizzbuzz(count(1), lambda i: i % 3 == 0, lambda i: i % 5 == 0)), 15))

this is probably better if we relax the requirement that 'fizzbuzz' be a single string and return a tuple instead.

Font?

>range: u64
LOL
Rust has built in ranges

Attached: Screenshot from 2018-11-11 19-00-16.png (1354x1544, 145K)

Rate my compile time recursive template specialized fizzbuzz
auto fizzbuzz(uint N)() {
static string accumulate;
return fizzbuzz!N(accumulate);
}

auto fizzbuzz(uint N)(ref string result) if (N % 3 && N % 5) {
import std.conv : to;

result ~= N.to!string ~ "\n";
return fizzbuzz!(N - 1)(result);
}

auto fizzbuzz(uint N)(ref string result) if (!(N % 15)) {
result ~= "FizzBuzz\n";
return fizzbuzz!(N - 1)(result);
}

auto fizzbuzz(uint N)(ref string result) if (!(N % 3) && N % 5) {
result ~= "Fizz\n";
return fizzbuzz!(N - 1)(result);
}

auto fizzbuzz(uint N)(ref string result) if (!(N % 5) && N % 3) {
result ~= "Buzz\n";
return fizzbuzz!(N - 1)(result);
}

auto fizzbuzz(uint N : 0)(ref string result) {
return result;
}

void main() {
import std.stdio : writeln;

fizzbuzz!50().writeln();
}

Attached: 1536410196291.png (264x274, 30K)

what is this autism. why not just use the language like a normal person? your turning rust into the cancer that is c++. kys

simple. fast. safe. easy to read.

import numpy
Fizzbuzz_table={1:0, 2:1, 3:2, 4:"Fizz", 5:4, 6:"Buzz", 7:"Fizz"
,8:7 ,9:8 ,10:"Fizz",11:"Buzz",12:11,13:"Fizz",14:13,
15:14,16:"FizzBuzz"}
n=1
def increment(X):
X=X+1
return X

def FizzBuzz_numbers(N):
number=0
while numpy.floor(float(N)/float(16))==0:
N=increment(N)
if Fizzbuzz_table[N]=="Fizz":
number="Fizz"
else:
if Fizzbuzz_table[N]=="Buzz":
number="Buzz"
else:
if Fizzbuzz_table[N]=="FizzBuzz":
number="FizzBuzz"
else:
number=n+Fizzbuzz_table[N]-1
print(str(number))

while 1==1:
FizzBuzz_numbers(1)
n=n+15

PROGRAM FIZZBUZZ
INTEGER t

DO 10 t = 1, 100
IF (MOD(t, 15) .EQ. 0) THEN
PRINT *, 'FIZZBUZZ'
ELSEIF (MOD(t, 5) .EQ. 0) THEN
PRINT *, 'BUZZ'
ELSEIF (MOD(t, 3) .EQ. 0) THEN
PRINT *, 'FIZZ'
ELSE
PRINT *, t
ENDIF
10 CONTINUE

END PROGRAM FIZZBUZZ

Pre-triggering for Jow Forums's comfort, VBScript.
Sub FizzBuzz(ByVal ANum)
If ANum Mod 15 = 0 Then
Echo "Fizzbuzz"
ElseIf ANum Mod 5 = 0 Then
Echo "Buzz"
ElseIf ANum Mod 3 = 0 Then
Echo "Fizz"
Else
Echo ANum
End If
End Sub

For I = 1 To Limit
FizzBuzz I
Next

How long does it take to compile?

#include
int main(){
for(int i=1;1;i+=15){
printf("%d %d Fizz %d Buzz Fizz %d %d Fizz Buzz %d Fizz %d %d FizzBuzz",i,i+1,i+3,i+6,i+7,i+10,i+12,i+13);}
return 0;}

rate

11/10 would kek again.

well does it work? phoneposting so i cant test it out

Attached: Screenshot from 2018-11-11 21-17-44.png (3840x2160, 273K)

whats the asm fizzbuzz?

(define fizzbuzz-check
(lambda (iter)
(begin
(cond
((= (mod iter 15) 0) (display "fizzbuzz"))
((= (mod iter 5) 0) (display "buzz"))
((= (mod iter 3) 0) (display "fizz"))
('t (display iter)))
(newline))))

(define fizzbuzz
(lambda (iter)
(cond
((= iter 100) (fizzbuzz-check 100))
(begin (fizzbuzz-check iter) (fizzbuzz (+ iter 1))))))

Yes.

I just added spaces and tabs and made it so it didn't run indefinitely (changed stop condition of for loop to < 105), I didn't change anything else.

#include
int main()
{
for (int i = 1; i < 105; i+=15) {
printf("%d %d Fizz %d Buzz Fizz %d %d Fizz Buzz %d Fizz %d %d FizzBuzz\n", i, i+1, i+3, i+6, i+7 ,i+10, i+12, i+13);
}
return 0;
}

Attached: chrome_2018-11-11_05-31-44.png (1473x212, 25K)

neat
this is faster than most other implementations right?

No, unless some serious compiler optimizations turn this into completely a compiletime operation.
The fastest one ITT is

+[-[>+--[>+>++>++>++++++>+>>>++++++>->++>+>>--[[>]>[[>++++++++++[->++++++++++>+
[>>>]++++++++++>+>]]++++++++[-]]

(defun is-mult-p (n multiple)
(= (rem n multiple) 0))

(defun fizzbuzz (&optional n)
(let ((n (or n 1)))
(if (> n 100)
nil
(progn
(let ((mult-3 (is-mult-p n 3))
(mult-5 (is-mult-p n 5)))
(if mult-3
(princ "Fizz"))
(if mult-5
(princ "Buzz"))
(if (not (or mult-3 mult-5))
(princ n))
(princ #\linefeed)
(fizzbuzz (+ n 1)))))))

A challenger appears
#include
#include
#include

// concatenate two arrays at compile-time
template
constexpr std::array concatenate(const std::array &lhs,
const std::array &rhs) {
std::array result{};
std::size_t index{0};
for (std::size_t i{0}; i=10 ? digits[(I/10)%10] : ' ',
digits[(I/1)%10], '\n' };
};

template
struct fizzbuzz_helper : int_to_str {
};

template
struct fizzbuzz_helper {
static constexpr std::array str{ 'F', 'i', 'z', 'z', '\n' };
};

template
struct fizzbuzz_helper {
static constexpr std::array str{ 'B', 'u', 'z', 'z', '\n' };
};

template
struct fizzbuzz_helper {
static constexpr std::array str{ 'F', 'i', 'z', 'z', 'B', 'u', 'z', 'z', '\n' };
};

template
struct fizzbuzz {
static constexpr auto str{concatenate(fizzbuzz::str, fizzbuzz_helper::str)};
};

template
struct fizzbuzz {
static constexpr auto str{fizzbuzz_helper::str};
};

int main() {
for (auto x: fizzbuzz::str)
std::cout

public static void main(String[] argv) {
int x = Integer.parseInt(argv[0]);
if(x < 0)
return;

main(new String[] {(x - 1) + ""});

if(x % 15 == 0)
System.out.println("fizzbuzz");
else if(x % 3 == 0)
System.out.println("fizz");
else if(x % 5 == 0)
System.out.println("buzz");
else
System.out.println(x);
}

I think you need to put the main(new String[] line at the end, or else it won't output anything.

Wrong.
It counts from N to 0, then outputs from 0 to N.