IMHO,
from my tests is the best version is Stefan's:
Actually, it seems you're correct. I was hoping my IB:FizzBuzz1 would outperform it since it uses assoc instead of nth on the exact same algorithm. But from tests it seems to be about on par with each other (and as stated my IB:FizzBuzz3 is the exact same algorithm):
Benchmarking .................... done for 32768 iterations. Sorted from fastest.
Statement Increment Time(ms) Normalize Relative
--------------------------------------------------------------------------------
(MAPCAR (QUOTE IB:FIZZBUZZ3) FIZZLIST) 32768 1607 1607 1.00
(MAPCAR (QUOTE PH:FB5) FIZZLIST) 32768 1654 1654 1.03
(MAPCAR (QUOTE IB:FIZZBUZZ1) FIZZLIST) 32768 1716 1716 1.07
(MAPCAR (QUOTE IB:FIZZBUZZ0) FIZZLIST) 32768 1919 1919 1.19
(MAPCAR (QUOTE PH:FB4) FIZZLIST) 32768 2012 2012 1.25
(MAPCAR (QUOTE PH:FB2) FIZZLIST) 32768 2043 2043 1.27
(MAPCAR (QUOTE IB:FIZZBUZZ) FIZZLIST) 16384 1030 2060 1.28
(MAPCAR (QUOTE KERRY:FIZZBUZZ) FIZZL...) 16384 1030 2060 1.28
(MAPCAR (QUOTE MAA:FIZZBUZZ_A2) FIZZ...) 16384 1045 2090 1.30
(MAPCAR (QUOTE LM:FIZZBUZZ) FIZZLIST) 16384 1185 2370 1.47
(MAPCAR (QUOTE MAA:FIZZBUZZ_A) FIZZL...) 16384 1202 2404 1.50
(MAPCAR (QUOTE IB:FIZZBUZZ2) FIZZLIST) 16384 1310 2620 1.63
(MAPCAR (QUOTE CAB:FIZZBUZZ) FIZZLIST) 16384 1326 2652 1.65
(JH:BIZZFIZZ FIZZLIST) 16384 1341 2682 1.67
(MAPCAR (QUOTE KEITH:FB) FIZZLIST) 16384 1607 3214 2.00
(MAPCAR (QUOTE CHRISCARLSON:FIZZFUZZ...) 16384 1669 3338 2.08
(THARWAT:FIZZBUZZ FIZZLIST) 16384 1966 3932 2.45
(MAPCAR (QUOTE RONJONP:_FB) FIZZLIST) 8192 1029 4116 2.56
(MAPCAR (QUOTE LM:FIZZBUZZ1) FIZZLIST) 8192 1576 6304 3.92
(MAPCAR (QUOTE IB:FIZZBUZZ4) FIZZLIST) 8192 6552 26208 16.31
--------------------------------------------------------------------------------
What does surprise me though is how much slower the member version is (even in comparison to the "naive" IB:FizzBuzz and IB:FizzBuzz0. And as I expected that convoluted IB:FizzBuzz4 of mine is rather silly-slow!
Great challenge Irné - although relatively simple, I've enjoyed this thread
My pleasure! It's a very simplistic challenge, but I thought it might be good since there are so many ways to achieve it.
It's scary if you see that something this simple is failed by 99% of programming job candidates (i.e. they're UNABLE to write even the naive one)! It's even more scary when you consider most of those guys have at least some accreditation for being "programmers" behind their names - ouch for the "level" of their teaching if this is the case!