old
((> x n) nil)
((f n
(+ 1 x
(rem x
2)) 0)) )
)
(f n 2 0)
)
Nice code , Evgeniy
Thanks Lee Mac and ribarm for your participation .
Hi Evgeniy , After I see your first version , It's so Concise . so I change it and test
((and (> (rem n x
) 0) (> y
0)) nil) ((f n
(+ 1 x
(rem x
2)) 0)) )
)
(f n 2 0)
)
Now , Test efficiency of All functions , I don't sure the Quickbench function is correct ( If like Kerry said it perhaps must be improve some . )
;;Quickbench copy from http://www.theswamp.org/index.php?action=dlattach;topic=42091.0;attach=22832
(QuickBench (mapcar '(lambda (f) (list f 19487171)) (list SF:pf LM:pf VK:pf SF:pf2 SS:pf eea)))
;;
Benchmarking ...... done for 32768 iterations. Sorted from fastest.
Statement Increment Time(ms) Normalize Relative
--------------------------------------------------------------------------------
(#<USUBR @000000002a1e7ea8 SF:PF2> 1...) 32768 1950 1950 1.95
(#<USUBR @000000002a0b3480 SS:PF> 19...) 16384 1060 2120 1.80
(#<USUBR @000000002a2ca200 EEA> 1948...) 16384 1092 2184 1.74
(#<USUBR @000000002a1e74f8 SF:PF> 19...) 16384 1107 2214 1.72
(#<USUBR @000000002a1e75e8 VK:PF> 19...) 16384 1639 3278 1.16
(#<USUBR @000000002a1e7728 LM:PF> 19...) 16384 1904 3808 1.00
--------------------------------------------------------------------------------
;;Quickbench copy from http://www.theswamp.org/index.php?action=dlattach;topic=42091.0;attach=22832
;;
(QuickBench (mapcar '(lambda (f) (list f 48828125)) (list SF:pf LM:pf VK:pf SF:pf2 SS:pf eea)))
;;
Benchmarking ...... done for 32768 iterations. Sorted from fastest.
Statement Increment Time(ms) Normalize Relative
--------------------------------------------------------------------------------
(#<USUBR @000000002a0b3480 SS:PF> 48...) 32768 1701 1701 2.57
(#<USUBR @000000002a1e7ea8 SF:PF2> 4...) 32768 1842 1842 2.37
(#<USUBR @000000002a2ca200 EEA> 4882...) 16384 1061 2122 2.06
(#<USUBR @000000002a1e74f8 SF:PF> 48...) 16384 1248 2496 1.75
(#<USUBR @000000002a1e75e8 VK:PF> 48...) 16384 1450 2900 1.50
(#<USUBR @000000002a1e7728 LM:PF> 48...) 8192 1091 4364 1.00
--------------------------------------------------------------------------------