I'd say it's all a matter of efficiency. In many cases, either  
representation would work and both are O(1) (on average in the  
hashtable's case).

OTOH, hash table access must be computed over and over again at run  
time whereas structure slot access can be computed at compile time.  
Another nice thing about defstruct is that it will define all of your  
accessors for you.

HTH,

On Mar 24, 2009, at 10:02 AM, Mason Loring Bliss wrote:

> On 2009-03-19 7:18 AM, Alessio Stalla wrote:
>
>> Since you want to store a fixed number of fields for every object,
>> structures or classes are better suited for your task:
>
> Would this be more efficient than just storing hashes in his outer  
> hash? It's
> how I'd do it in Perl, where hashes are a very natural medium. I've  
> come to
> think of hashes in Common Lisp as serving an identical purpose.
>
> -- 
> Mason Loring Bliss             [email protected]            Ewige  
> Blumenkraft!
> (if awake 'sleep (aref #(sleep dream) (random 2))) -- Hamlet, Act  
> III, Scene I
> _______________________________________________
> Gardeners mailing list
> [email protected]
> http://www.lispniks.com/mailman/listinfo/gardeners

--
Gary Warren King, metabang.com
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM * gwking on twitter





_______________________________________________
Gardeners mailing list
[email protected]
http://www.lispniks.com/mailman/listinfo/gardeners

Reply via email to