Article View: comp.lang.prolog
Article #3294Re: compatibility/elegance & *theory*
From: Richard Tobin
Date: Thu, 28 Apr 1988 01:29
Date: Thu, 28 Apr 1988 01:29
35 lines
1861 bytes
1861 bytes
In article <903@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes:
>Actually, call/1 in Prolog is a pretty straightforward APPLY. (There is
>a family of call/N things each adding N-1 extra arguments.) The problem
>is that ','/2 and so on are FEXPRs. (Is everyone nicely confused now?)
Yup.
>The point is that call(','(write(a)), write(b)) ends up calling write(a)
>and write(b), not because call/2 does anything special, but because (A,B)
>calls A and B. It is as if you did
> (APPLY #'(LAMBDA (X Y) (AND (EVAL X) (EVAL Y)))
> '(PRINT 'a) '(PRINT 'b) '())
>in Lisp.
Is this really true? Isn't it the case that in all reasonable prologs
call/1 *is* a simple interpreter, with the result that (in particular)
cut works reasonably?
For example,
X = (repeat, write(x), !, fail), call(X).
prints just one x, but if I define the operator 'and' (with precedence like
that of comma) to be
A and B :- call(A), call(B).
then
X = (repeat and write(x) and ! and fail), call(X).
prints rather a lot of x's.
Are you being disingenuous here, or have I just eaten too much microwave
popcorn?
-- Richard
--
Richard Tobin, JANET: R.Tobin@uk.ac.ed
AI Applications Institute, ARPA: R.Tobin%uk.ac.ed@nss.cs.ucl.ac.uk
Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin
Technical Details
Message-ID:
<383@aiva.ed.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!ukc!its63b!aiva!richardReferences:
<136@vor.esosun.UUCP> <841@cresswell.quintus.UUCP> <365@aiva.ed.ac.uk> <903@cresswell.quintus.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!ukc!its63b!aiva!richard From: richard@aiva.ed.ac.uk (Richard Tobin) Newsgroups: comp.lang.prolog Subject: Re: compatibility/elegance & *theory* Message-ID: <383@aiva.ed.ac.uk> Date: 28 Apr 88 01:29:26 GMT References: <136@vor.esosun.UUCP> <841@cresswell.quintus.UUCP> <365@aiva.ed.ac.uk> <903@cresswell.quintus.UUCP> Reply-To: richard@uk.ac.ed.aiva (Richard Tobin) Organization: Bannerman's Bar, Cowgate, Edinburgh Lines: 35