[m-rev.] for review: use list syntax in mdb

Mark Brown dougl at cs.mu.OZ.AU
Wed Oct 23 17:37:28 AEST 2002


On 23-Oct-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 23-Oct-2002, Mark Brown <dougl at cs.mu.OZ.AU> wrote:
> > +app([7, 8, 9, 0, 1, 2, 3, 4, ...], [|]/2, [|]/2)
> 
> I think it would be a little more readable to display lists
> at the depth limit as "[...]" rather than "[|]/2".

I implemented a few different versions of this change before selecting
the one I posted, and what you suggest is similar to one of the other
versions I tried.  I picked the one that looked the best, in my humble
aesthetic judgement, and I'll try to explain why.

The main reason I chose to avoid "[...]" is that I thought it looked ugly---
it looks like some text web browser's rendition of an input field.  Perhaps
more importantly, though, it seems somewhat ambiguous as to whether the
brackets are part of the (object-level) term, or part of the (meta-level) 
abbreviation.  In quotations, which is where this kind of ellipsis would
be most familiar to users, square brackets, like ellipses, are normally
meta-level (e.g.  "... [sic] ...").  For us to use it in the other sense
may therefore be confusing, but if at least the first element of the list
is given then the ambiguity is resolved.  Finally, we use "..." specifically
as a way of saying that a list has been shortened, so the ellipsis reads a
bit like "et cetera".  For et cetera to work, at least one element of the
list needs to be given, but "[...]" doesn't do this.

The way the version I posted avoids "[...]" is that, when the list is one
less than the depth limit (hence the elements of the list are at the depth
limit), we print the first element in functor/arity form and follow it with
", ...".  The ellipsis is only ever printed immediately after a comma.
If the size limit is exceeded while printing the elements of a list, the
remaining elements are replaced by "...", except that if the first
element has not been printed we print it in functor/arity form before
using the ellipsis for the second and subsequent elements.

If you still like "[...]", then you would probably prefer one other version
I wrote.  This one prints lists at one less than the depth limit as
"[...]", and doesn't have the above exception to the size limit rule.
It currently prints lists at the depth limit as "[|]/2", but that can
easily be changed.

Comments, anyone?

Cheers,
Mark.

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list