From p.singleton@keele.ac.uk Thu Feb 22 01:51:50 2001
Received: from scooby.lineone.net (doggy.lineone.net [194.75.152.224])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f1M0poZ15034
	for <prolog@swi.psy.uva.nl>; Thu, 22 Feb 2001 01:51:50 +0100 (MET)
Received: from keele.ac.uk (host213-123-68-123.dialup.lineone.co.uk [213.123.68.123])
	by scooby.lineone.net (8.9.3/8.9.3) with ESMTP id AAA06222;
	Thu, 22 Feb 2001 00:50:03 GMT
Message-ID: <3A946152.A33023B6@keele.ac.uk>
Date: Thu, 22 Feb 2001 00:46:10 +0000
From: Paul Singleton <p.singleton@keele.ac.uk>
Organization: SmartArts Computing Consultancy
X-Mailer: Mozilla 4.74 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: "Richard A. O'Keefe" <ok@atlas.otago.ac.nz>,
   SWI Prolog <prolog@swi.psy.uva.nl>
Subject: Re: [SWIPL] keysort
References: <200102202353.MAA21065@atlas.otago.ac.nz>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

>         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

