On Mar 11, 2006, at 7:16 PM, Bryan Sant wrote:
On 3/11/06, Bryan Sant <[EMAIL PROTECTED]> wrote:Sounds great. So when do we get to see the solution to Sasha's dictionary problem implemented in Lisp? I'm dying to see the result. -BryanSorry. I just saw the posted Common Lisp code. What is the most optimal way to execute this code? Is there a particular lisp implementation that is faster than another? -Bryan
Actually, due to a misunderstanding of what he asked for, the code didn't do what the other implementations did. It found *unique* words (as in, only had a count of 1) rather than all *distinct* words and their count. I realized this a while ago and re-wrote it. So, use the attached version rather than the earlier one.
I recommend SBCL. Just fire it up and type (load "/path/to/ dicttest.lisp"), and it will load and compile the file. Then type (find-word-counts "/path/to/filename"), and you should get the result in a small fraction of a second. To find out how long it takes to execute, use (time (find-word-counts ... )).
As I mainly did this as an exercise, I didn't profile or optimize it at all, though sbcl does provide two different profilers and several ways to ask the compiler to perform various optimizations.
--Levi
dicttest.lisp
Description: Binary data
/* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
