Hi,
POP11 has a built in 'pattern matcher' called MATCHES which can be
used for checking the correspondence of a list with a pattern.
Does anyone know if there is a "pattern matcher" like function in
LISP?
Thanks,
Deftone
Deftone wrote:
> POP11 has a built in 'pattern matcher' called MATCHES which can be
> used for checking the correspondence of a list with a pattern.
Pardon my stupidity, but what is POP11?
Cheers,
:) will
In article <·················@pindar.com>,
William Deakin <········@pindar.com> wrote:
(snip)
>Pardon my stupidity, but what is POP11?
(snip)
From http://www.cogs.susx.ac.uk/users/adrianh/pop11.html,
"The Pop-11 language is similar to Lisp in power, but with a more
traditional (some would say readable) syntax."
That page has plenty of Pop-11 and Poplog links.
-- Mark
Mark Carroll wrote:
> "The Pop-11 language is similar to Lisp in power, but with a more
> traditional (some would say readable) syntax."
Is this possible?
Thanks for the link. I have heard of poplog, Professor Aaron Sloman has
posted a release notice and I know it is well respected. But pop-11? I
though that this was what told you that your email has arrived ;)
Best Regards,
:) will
ps: I second the request for examples.
On Mon, 18 Oct 1999 11:11:28 +0100, William Deakin <·····@pindar.com> wrote:
> Mark Carroll wrote:
>
> > "The Pop-11 language is similar to Lisp in power, but with a more
> > traditional (some would say readable) syntax."
>
> Is this possible?
>
> Thanks for the link. I have heard of poplog, Professor Aaron Sloman has
> posted a release notice and I know it is well respected. But pop-11?
Pop-11 is a programming language. Poplog is a programming environment for
Pop-11 and some other symbolic programming languages (CL, Prolog, ML, I
think).
__Jason
In article <····························@4ax.com>, Deftone <·@p.com> wrote:
>Hi,
>
>POP11 has a built in 'pattern matcher' called MATCHES which can be
>used for checking the correspondence of a list with a pattern.
>
>Does anyone know if there is a "pattern matcher" like function in
>LISP?
For those of us unfamiliar with POP11, could you give an example of
how you might use MATCHES with an example pattern? That might help
us help you. (-:
-- Mark
Mark Carroll wrote:
>
> In article <····························@4ax.com>, Deftone <·@p.com> wrote:
> >Hi,
> >
> >POP11 has a built in 'pattern matcher' called MATCHES which can be
> >used for checking the correspondence of a list with a pattern.
> >
> >Does anyone know if there is a "pattern matcher" like function in
> >LISP?
>
> For those of us unfamiliar with POP11, could you give an example of
> how you might use MATCHES with an example pattern? That might help
> us help you. (-:
From.... ftp://ftp.cs.bham.ac.uk/pub/dist/poplog/teach/primer
;;; Simple examples, using the matcher like an equality tester:
[a b c d] matches [a b c d] =>
** <true>
[a b c d] matches [d b c a] =>
** <false>
both the following complex expressions denote TRUE
[who is the father of joe] matches [who is == ]
[where is the father of joe] matches [where is == ]
The following also denote TRUE:
[you are my favourite programming pupil] matches [== pupil]
[the little dog laughed to see such fun] matches [== dog ==]
here is a procedure which uses MATCHES to decide
whether a question requires a person or a place as its answer:
define type_of_answer(list) -> type;
if list matches [who is ==] then
"person" -> type
elseif list matches [where is == ] then
"place" -> type
else
"undef" -> type
endif
enddefine;
type_of_answer([who is your father]) =>
** person
type_of_answer([where is your father]) =>
** place
type_of_answer([is Joe your father]) =>
** undef
"undef" is a word often used in in Pop-11 to indicate something
unknown.
Here is an example, in which we change the
above procedure to return two results, the type of question, and the
contents of the question. Note that we have to use "vars" to declare a
variable as a pattern variable:
define type_of_answer(list) -> (type, contents);
vars remainder;
if list matches [who is ??remainder] then
"person" -> type;
remainder -> contents;
elseif list matches [where is ??remainder ] then
"place" -> type;
remainder -> contents;
else
"undef" -> type;
[] -> contents;
endif
enddefine;
This can now be tested:
type_of_answer([why can pigs fly]) =>
** undef []
type_of_answer([who is the murderer]) =>
** person [the murderer]
type_of_answer([where is the murderer]) =>
** place [the murderer]
Well... you get the idea.
Its a very handy little piece of functionality, but AFAIK its not
usually included in CL environments. Luckily, it wouldn't take long to
write if you wanted to, and if you were new to LISP it would definitely
be a good way to learn...
CU
Dobes
Deftone <·@p.com> writes:
> Hi,
>
> POP11 has a built in 'pattern matcher' called MATCHES which can be
> used for checking the correspondence of a list with a pattern.
>
> Does anyone know if there is a "pattern matcher" like function in
> LISP?
>
The AI.Repository has one. It has the usual problems with the MK's
copyright though.
I also have a different version written by Georg Bauer, which I
believe I collected from CLL some time ago. It has no copyright, so
maybe it is re-distributable.
Cheers
--
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26
http://www.parades.rm.cnr.it/~marcoxa
Marco Antoniotti wrote in message ...
>I also have a different version written by Georg Bauer, which I
>believe I collected from CLL some time ago. It has no copyright, so
>maybe it is re-distributable.
If this is so, could I have a look please? This is something I would like to
look at following on from the regexp thread last week.
Best Regards,
:) will
Deftone <·@p.com> writes:
> POP11 has a built in 'pattern matcher' called MATCHES which can be
> used for checking the correspondence of a list with a pattern.
>
> Does anyone know if there is a "pattern matcher" like function in
> LISP?
There was a paper presented at the LUGM last week which described a
pattern matcher written in LISP that was supposedly influenced by
POP11's MATCHES facility.
Unfortunately, I do not think anything was mentioned regarding the
availability of the source code (I could be wrong, I was about 15
minutes late to the talk). Does anyone know the whole story?
POP11 has a built in 'pattern matcher' called MATCHES which can be used
for checking the correspondence of a list with a pattern. Does anyone know
if there is a "pattern matcher" like function in LISP?
I don't know if it's the same as POP11, but "Paradigms of Artificial
Intelligence Programming: Case Studies in Common Lisp" by Peter Norvig has
code that does both "pattern matching" and "unification" (matching patterns
to patterns). Source code is available free: http://www.norvig.com/paip/
Larry
--
Lawrence Hunter, Ph.D. Chief, Molecular Statistics and Bioinformatics
National Cancer Institute email: ·······@nih.gov
Federal Building, Room 3C06 phone: +1 (301) 402-0389
7550 Wisconsin Ave. fax: +1 (301) 480-0223
Bethesda, MD 20892 USA
In article <···············@work.nci.nih.gov>,
Larry Hunter <·······@nih.gov> wrote:
>I don't know if it's the same as POP11, but "Paradigms of Artificial
>Intelligence Programming: Case Studies in Common Lisp" by Peter Norvig has
>code that does both "pattern matching" and "unification" (matching patterns
>to patterns). Source code is available free: http://www.norvig.com/paip/
... But buy the book anyway, as it's a great source of ideas and Lisp
lore as practiced in the early '90s, and still extremely valid today.
And yes, I'd have said this even if Norvig *wasn't* my division chief!
-- Chuck
--
Chuck Fry -- Jack of all trades, master of none
······@chucko.com (text only please) ········@home.com (MIME enabled)
Lisp bigot, car nut, photographer, sometime guitarist and mountain biker
The addresses above are real. All spammers will be reported to their ISPs.