Subject: Re: [SWIPL] keysort

From: Paul Singleton <[email-masked]>
Date: Thu, 22 Feb 2001 00:46:10 +0000

>         So there often seems to be a conflict between choosing a data
>         structure for design-time efficiency and choosing it for
>         run-time efficiency, and between expressing its particular
>         semantics and compactly representing its essential structure.

> I don't know what you mean by design-time efficiency.
> Can you explain?

I mean: efficient in design, coding and testing effort; making use of
well-documented and well-tested library ADTs and of higher-order (?)
predicates such as maplist, versus writing a new edge/3 ADT from scratch.

It shouldn't be, but it is too easy (for inexperienced or undisciplined
programmers) to make trivial mistakes (e.g. re: steadfastness or stray
choicepoints) when coding; sometimes I forget to put terminating facts
e.g. this_to_that([], Ys, Ys) in my procedures!  Maybe we should use
code templates for common patterns, although I suspect the best solution
is decent partial evaluation.  Whatever, too often Prolog coding feels
like assembler coding; I think: I can't believe I'm writing this code
pattern *again*!  why can't I specify it in some concise, abstract
syntax and turn a handle to get efficient code out?  And in some sense
I think the same goes for data structures...

NB why is

  type bag --> bag( element, multiplicity, bag)
            |  bag

rather than

  type bag --> ordset(pair(element,multiplicity))

??

Paul Singleton