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

Re: Fundamental design flaws

On Thu, 30 Oct 2003 scgmille@xxxxxxxxxxxxxxxxxx wrote:

>On Thu, Oct 30, 2003 at 11:45:26AM -0800, bear wrote:

>> On Thu, 30 Oct 2003 scgmille@xxxxxxxxxxxxxxxxxx wrote:

>> >But they cannot be defined if they don't apply to the general class of
>> >collections.  They need to be defined for those concrete classes or a
>> >more specific general one (like ordered tree).
>> Of course they can be defined for generic collections.  You can get
>> the last element of a list; it's just the worst possible structure
>> for that operation to be efficient.  Similarly, you can get a range
>> of keys from an unordered alist, or any of the other "shortcut"
>> operations.
>But what about a dictionary with no ordering at all?

In that case you just get whichever N elements are most efficient
to get.  Or maybe you call the error continuation and make the
user replace them with a call that makes it *explicit* that he's
not interested in orderedness anymore -- but that's self-evident
if he's using an unordered collection type, so it seems needlessly
pedantic to me.

Where notions of "first", "last", "orderedness", etc, are undefined,
I'm perfectly happy to have functions such as "get-first" or whatever
completely ignore those undefined concepts and be used as aliases to
"get-any." And "any", in my book, means whichever value you can get
and return the fastest.