[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: when to use strings, when to use symbols
From: |
Thien-Thi Nguyen |
Subject: |
Re: when to use strings, when to use symbols |
Date: |
Sun, 09 Jan 2011 10:23:59 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
() Andy Wingo <address@hidden>
() Sat, 08 Jan 2011 18:25:32 -0800
* Use symbols when you want to match against
a symbol literal in your source code.
* Use strings otherwise.
Symbols are preferable whenever ‘eq?’ is important
(for whatever reason, depending on program design).
Many times that involves matching against a symbol
literal, but that's a specific case.
For example, if the accepted alist is intended for
key duplicates pruning, using a symbol in the key
means you can use ‘assq’ (i.e., ‘eq?’), which can
be (and usually is) more performant than ‘assoc’.