3 ms·
The original: http://philcrissman.net/posts/eulers-fizzbuzz/ http://philcrissman.net/posts/eulers-fizzbuzz/ I find this part inscrutable: > It is possible to
by tantalor 6y ago
The original: http://philcrissman.net/posts/eulers-fizzbuzz/ http://philcrissman.net/posts/eulers-fizzbuzz/
I find this part inscrutable:
> It is possible to write a function which uses no conditional logic at all
And then goes on to show several examples in python, ruby, and mathematical syntax using condition logic.
I mean, just moving the conditions into a lookup table does make it "not conditional".
These programs both use conditional logic:
for x in range(10):
print(x, 'is', 'odd' if x % 2 else 'even')
for x in range(10):
print(x, 'is', ('even', 'odd')[x % 2])
- deleted 6y ago[deleted]
- setr 6y agoAccording to the cpu, you won't have any branching with a LUT -- so you can pipeline everything nicely So at least from that perspective, you've eliminated the impact of the condition