Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8680
| From | Szabolcs Horvát <szhorvat@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How best to implement a hash table in Mathematica |
| Date | 2012-02-21 11:21 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jhvuoi$891$1@smc.vnet.net> (permalink) |
| References | <jho21j$5sb$1@smc.vnet.net> <jhqmrr$fbq$1@smc.vnet.net> <jhstsv$nk0$1@smc.vnet.net> |
On 2/20/2012 9:48 AM, Joseph Gwinn wrote:
>
> The reason to initialize the hashtable in advance is so a later probe to
> an empty table element yields {}, versus repeating the question back.
>
>
I probably don't understand your question completely, but why can't you
just make definition like
hashtable[_] = {}
? This will ensure that {} is returned for "undefined" keys.
Also, please avoid using symbols that start with a capital letter.
HashTable is a built-in symbol and if you define it (as you did in the
example code you sent), it is likely to break stuff.
--
Szabolcs Horvát
Visit Mathematica.SE: http://mathematica.stackexchange.com/
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-18 11:28 +0000
Re: How best to implement a hash table in Mathematica Szabolcs Horvát <szhorvat@gmail.com> - 2012-02-19 11:29 +0000
Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-20 07:50 +0000
Re: How best to implement a hash table in Mathematica David Bailey <dave@removedbailey.co.uk> - 2012-02-19 11:36 +0000
Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-20 07:48 +0000
Re: How best to implement a hash table in Mathematica A Retey <awnl@gmx-topmail.de> - 2012-02-21 11:20 +0000
Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-22 10:36 +0000
Re: How best to implement a hash table in Mathematica Szabolcs Horvát <szhorvat@gmail.com> - 2012-02-21 11:21 +0000
Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-22 10:35 +0000
Re: How best to implement a hash table in Mathematica Richard Fateman <fateman@cs.berkeley.edu> - 2012-02-19 11:36 +0000
Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-20 07:49 +0000
Re: How best to implement a hash table in Mathematica Richard Fateman <fateman@cs.berkeley.edu> - 2012-02-21 11:11 +0000
Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-22 10:36 +0000
Re: How best to implement a hash table in Mathematica Leonid Shifrin <lshifr@gmail.com> - 2012-02-22 10:34 +0000
Re: How best to implement a hash table in Mathematica "Nasser M. Abbasi" <nma@12000.org> - 2012-02-23 10:51 +0000
Re: How best to implement a hash table in Mathematica Leonid Shifrin <lshifr@gmail.com> - 2012-02-24 06:00 +0000
csiph-web