🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.functional
Article #270

Re: Pattern matching considered harmful

#270
From: Aaron Sloman
Date: Thu, 07 Jun 1990 00:46
57 lines
3175 bytes
jeff@aiai.ed.ac.uk (Jeff Dalton) writes:

 ...stuff deleted....

In response to your objections to representing data using a
positional notation I guess I missed the point the first time. Yes I
agree that in general it is _not_ a good thing to be committed to
anything so concrete, _except_ where the concrete structure is
closely related to the semantics you intend: e.g. if you are using
ordered components of a structure to represent objects that stand in
some order (e.g. words in a sentence, the sequence of rulers of
Britain, etc.) just as it is convenient to use a 2-D array to
represent an image because the neighbourhood and ordering relations
in the array correspond closely to the neighbourhood and ordering
relations in the image (or in the optic array from which the image
is a sample).

But where the order of items in a list or data-structure has no
significance, i.e. is totally arbitrary, I agree that it is unwise
to build programs around that order, and much better to use
a more abstract representation.

I presume the introduction of keyword arguments in Common Lisp was
in part an attempt to avoid the same sort of limitation (i.e.
restriction to positional notation) in procedure definitions?

On a historical note:
> ]] By the way, what happens with a pattern like
> ]]
> ]]     [[??a ??b] ??a]
> ]]
> ]] "[??a ??b]" can match in more than one way.  Will more than one
> ]] possibility be tried when trying to match the second "??a"?
> ]]
> ]Good point. In fact the standard Poplog Pop-11 matcher cannot find
> ]the way to match this successfully (though the Alphapop matcher
> ]designed by Jon Cunningham can).
>
> I thought Poplog might handle such things because it uses downward
> success continuations (I think) for the "log" part (ie for Prolog).

I guess we could have implemented the Pop-11 pattern matcher using
the Poplog virtual machine facilities built in to support prolog,
but in fact the Pop-11 matcher was first written in PDP-11
assembler (!) by Steve Hardy when Pop-11 was used on the PDP11/40
computer for teaching, then when it got ported to the VAX the
matcher got re-written in Pop-11 (circa 1981?) and has barely
changed since. The continuation handling stuff was put into Poplog
later.

I think Jon Cunningham wrote his more general Pop-11 matcher for the
Alphapop (MAC Pop-11) system by implementing a version in Poplog
Prolog, then looking at the Poplog VM the code it generated and
then re-implementing in Pop-11, and then finally translating it to C
(in which Alphapop is written).

Aaron
Technical Details
Message-ID: <2818@syma.sussex.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mit-eddie!bloom-beacon!eru!luth!sunic!mcsun!ukc!icdoc!syma!aarons
References: <2584@skye.ed.ac.uk> <3077@goanna.cs.rmit.oz.au> <2790@syma.sussex.ac.uk> <2631@skye.ed.ac.uk> <2798@syma.sussex.ac.uk> <2698@skye.ed.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mit-eddie!bloom-beacon!eru!luth!sunic!mcsun!ukc!icdoc!syma!aarons
From: aarons@syma.sussex.ac.uk (Aaron Sloman)
Newsgroups: comp.lang.functional,comp.lang.prolog
Subject: Re: Pattern matching considered harmful
Message-ID: <2818@syma.sussex.ac.uk>
Date: 7 Jun 90 00:46:27 GMT
References: <2584@skye.ed.ac.uk> <3077@goanna.cs.rmit.oz.au> <2790@syma.sussex.ac.uk> <2631@skye.ed.ac.uk> <2798@syma.sussex.ac.uk> <2698@skye.ed.ac.uk>
Organization: School of Cognitive & Computing Sciences, Sussex Univ. UK
Lines: 57