Re: Remarks on SWI 7
Ulrich Neumerkel <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Richard O'Keefe: >On 29/11/2013, at 4:36 AM, Ulrich Neumerkel wrote: >> Can we agree the Quintus manual differs? >> >> http://quintus.sics.se/isl/quintus/html/quintus/mpg-ref-length.html > >We can agree that the manual doesn't say that there is an >exception if the List argument is malformed, BUT it's arguably >vague. The whole of the text talks only about what happens >when it is a list (possibly of indefinite length). It's not >*obvious* what would happen for length(42, 2). For this reason there is a "Template and Modes" subclause in the definition of a predicate. This makes clear what error checking is intended. It is length(?term, ?integer) Which means: no checking on the first arg, checking for type integer on the second. No direct instantiation errors. http://www.complang.tuwien.ac.at/ulrich/iso-prolog/prologue#length would the list be checked, it would be length(?list, ?integer) I am told, also Quintus 3.5 does not check the list. So the documentation is accurate. >This is actually one of the reasons why a standard scrutinised >by a legion of nitpickers is so useful. "Things that go without >saying" sometimes need saying, so that everyone says the same. Yes! p.p.3.1 Procedurally, ... is not perfect. >What I was trying to say was that I have strong sympathy with >Jan's preference for length/2 BUT if he's right, _everyone_ should >do the same, and he'd do more good for the world by > (a) conforming to the standard > (b) adding a new operation list_length(List, Length) doing what > he wants > (c) then lobbying for either the adoption of list_length/2 > or a revision to length/2. Originally, I also favoured checking. In fact, I wrote that checking length/2 for SWI. But then there were also many arguments against it. Who would go that far as to insist on checking the first argument of append/3? In any case, that is the very idea of having as many Prolog people together to resolve such issues.