Talk:Kaprekar numbers: Difference between revisions

Added a talk section for the Common Lisp implementation; Discussed reverting back to an older version of the CL implementation.
No edit summary
(Added a talk section for the Common Lisp implementation; Discussed reverting back to an older version of the CL implementation.)
Line 148:
It works with Numeric Digits 14
--[[User:Walterpachl|Walterpachl]] 14:53, 29 June 2012 (UTC)
 
 
== Common Lisp Implementation ==
 
Let me start by saying that I feel the criteria that should be used to modify existing code are the following:
*Correctness
*Fulfilling additional tasks / generality
*Improved readability
*Use of a programming languages idioms - For example, in CL the use of multiple return values is preferred to say setting multiple global variables.
*Improved performance
*(Note: There may be some special situations missing from this list)
 
Using these criteria, I modified the original CL implementation mainly because I thought that I could improve the readability by using more Lisp language features like multiple return values. In short, I felt like I was reading a C program written in Lisp: The original code isn't 'Lispy'. Later, I made some changes to the basic algorithm that substantially improved the performance (and even later came across the CO9 technique which again substantially improved performance). Because the original version supports additional number bases, I decided to add a separate fast version and retain the older, more general, version. Recently, [[Nigel Galloway]] added support for all number bases to the 'fast implementation'. Based on the criteria above, I would normally find this to be an improvement, however, the code again resembles a C implementation written in Lisp (especially with the global bindings of BASE and BASE-1) and the performance has also decreased substantially. My version is able to finish the first 1 million Kaprekar numbers in ~9.1 seconds; The new version finishes in ~124 seconds. Memory usage and garbage collection also increased by an order of magnitude.
 
Because the new version lacks additional generality beyond the 'slow version', decreases readability and the use of Lisp idioms, and is substantially slower than the previous version, I've decided to revert the changes made by Nigel. I added this talk section to explain my rationale for making the revision. --[[User:Lhignight|Larry Hignight]] 23:40, 18 September 2012 (UTC)
Anonymous user