Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Are ordered hashes useful?



Simon Cozens writes:
 > On 14/02/2011 03:20, Stephen J. Turnbull wrote:
 > > But most of the examples you give there (eg, histogram) are really
 > > special cases of dictionary.
 > 
 > No, I don't think so, and this is the point. Dictionaries define a
 > transformation between list A and list B.  What we often think of
 > as mapping between two lists is more often asking questions about
 > the structure of one list.

Do you mean a "list of structures"?  The example I have in mind is
Emacs (why aren't you surprised?) where often we want to ask questions
about the character at some position in a buffer.  For example, is it
a parenthesis-like character that should have a match somewhere else?
Is it a space character allowing a line break when filling text?
Rather than turn buffer characters into structures, of course Emacs
handles this by representing characters as themselves, and many
properties as dictionaries mapping characters to appropriate values.

But I don't see why that invalidates the example of "histogram is
dictionary", especially not that example.  A histogram does *not* tell
you the structure of a list (except itself, ie, the list of ordered
pairs).  Rather, a very common use of histograms is to compare
different distributions on the *same* domain -- clearly any given
histogram is not a property of the domain in that case.  So as far as
I can see the only thing special about histograms is that they happen
to take non-negative numerical values for all keys.


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links