News for hackers. Stuff that matters.
Re:Euler's Fizzbuzz (2020) by kingaillas on Tuesday March 16, 2021 @11:31AM (#26478127)
His point was writing a function without conditional logic, and then of course generalizing to any "fizzbuzz category" problem.

I thought it was a fantastic post on a extremely well trodden subject, up there with solving fizzbuzz in Tensorflow post. (https://joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/)

Re:Euler's Fizzbuzz (2020) by LanceH on Tuesday March 16, 2021 @11:47AM (#26478371)
My entry to use random-isn't-random: https://github.com/LanceH/fizzbuzz/blob/master/fb.go

I feel like I need to revisit after seeing tensorflow and Euler. I need to find some way of making the lucky number using things around a room, like a mentalist or something.

Some other subversive ones I've seen of are the java enterprise version, and several that import a fizzbuzz library and just run.

Re:Euler's Fizzbuzz (2020) by isaacimagine on Tuesday March 16, 2021 @01:08PM (#26479663)
I find that random-not-random implementation pretty incredible.
Re:Euler's Fizzbuzz (2020) by LanceH on Tuesday March 16, 2021 @02:29PM (#26480869)
Thanks.

It seems kind of obvious compared to the Euler method, though. Once you realize it's 4 bits across a cycle of 15, it's just just a matter of finding the right seed. It should be on the order of 1 in a billion, which is no big deal. In hindsight, if I had combined my number theory knowledge I might have been able to accomplish the Euler solution, but I didn't, so hats off to them.

The presentation of the tensorflow provides more a much higher contempt for the question than I've achieved as well. The fact it isn't 100% accurate, but can be trained to be accurate to a certain level, just makes it better.

I will redouble my research efforts on this or some other problem which doesn't need solving.

Re:Euler's Fizzbuzz (2020) by uuidgen on Tuesday March 16, 2021 @02:33PM (#26480916)
But there is conditional logic "hidden" in lambda mapping.

You want it without ANY conditional logic try this

(python3): [str(n)*(n%3!=0)*(n%5!=0) + 'Fizz'*(n%3==0) + 'Buzz'*(n%5==0) for n in range(1,101)]

Re:Euler's Fizzbuzz (2020) by chongli on Tuesday March 16, 2021 @03:59PM (#26482062)
There’s tons of hidden conditional logic in the Python string multiplication operator. It’s implemented via the C function unicode_repeat which handles all the conditional logic.
Re:Euler's Fizzbuzz (2020) by uuidgen on Tuesday March 16, 2021 @07:24PM (#26484558)
If you're talking about assembly then every single statement in python will involve hidden conditions.

I was talking about the idea behind the code - that map is a pythonic shorthand for a bunch of if-then statements, it still expresses conditionals. While using string multiplication doesn't.