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

RE: error correction (was circular graphs)

Francois-Rene Rideau wrote:
> On Thu, Jun 19, 2003 at 06:00:34PM -0400, Shriram Krishnamurthi wrote:
> > Guy Steele - Sun Microsystems Labs wrote:
> >>   (mapcar #'+ x '#1=(1 -1)) ;; [assume '#1=(1 -1 #1#)]
> [And that was actually '#1=(1 -1 . #1#) !]
> OK. So by what wonder of the thinking apparatus has Guy made this mistake?
> By what wonder have so many of us looked at the code briefly and
> understood what Guy *meant* despite his code being wrong?

Guy's example had both an embedded "type definition" - the upfront
declaration that the code involved a "circular structure" - as well as
sample input & ouput values.  So there was quite a bit of redundant
information to support error-checking, to the point where the exact syntax
of the code in question was almost unimportant:

   > Sometimes an circular structure can be used to "advantage".
   > Consider this bit of code:
   >   (mapcar #'+ x '#1=(1 -1))
   > If x is (1 4 7 10), the result will be (2 3 8 9).

It's as if the code read (mapcar #'+ x (circular-list 1 -1)).

> Can such an implicit error-correcting behaviour be explicited?
> Can it be automated? Has it been implemented?
> What's the state of the art in DWIM technology?

Another aspect of our ability to extract Guy's meaning from his example is
that we were able to determine which of the conflicting information was
correct (assuming awareness of the conflict).  How did we know that the use
of the phrase "circular list" and the provided input->output mapping was
correct, as opposed to the code fragment?  That required an understanding of
the context and broader intent.  Now we're talking about some pretty strong