A Tangential Discourse on Lisp and the Lineage of Languages

Levi Pearson levi at cold.org
Sat Mar 11 22:41:24 MST 2006


On Mar 11, 2006, at 7:16 PM, Bryan Sant wrote:

> On 3/11/06, Bryan Sant <bryan.sant at gmail.com> 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.
>>
>> -Bryan
>
> Sorry.  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dicttest.lisp
Type: application/octet-stream
Size: 1534 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20060311/a9e2d0df/attachment.obj 


More information about the PLUG mailing list