🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #503

Re: Fun. vs. Logic

#503
From: Lee Naish
Date: Mon, 20 Nov 1989 05:07
41 lines
2420 bytes
In article <2743@munnari.oz.au> ok@mudla.cs.mu.OZ.AU (Richard O'Keefe) writes:
>There is not one tiny little thing to stop you using functional syntax in
>Prolog if you really want to.  Lee Naish and I both have term_expansion
>hooks to let you use functional syntax in ordinary Prolog code; mine is
>for Quintus/SICStus Prolog, his is for NU Prolog.  With NU Prolog
>coroutining behind you, you can generate lazy code if you want.

I don't think current coroutining systems are quite smart enough to give
you lazy evaluation.  My implementation of NU-Prolog + equations
("NUE-Prolog") does allow lazy evaluation but it can run under a
conventional Prolog with no problems.  The generated code does include
"when declarations" which control coroutining, but normally the
execution proceeds left to right.  The when declarations are there so
that if you call a function with the input uninstantiated the
evaluation will be delayed and, more importantly, the compiler will
generate better indexing for the code (it will index on all inputs and
thus avoid creating choice points).  An added advantage is that the code
can be run using stream and-parallelism (PNUE-Prolog?).  The input to
the system looks like this:

?- lazy concat/2.	% optional
concat([], A) = A.
concat(A.B, C) = A.concat(B, C).

The system is currently written as a preprocessor.  I have been meaning
to make it a bit more flexible, so it can output conventional Prolog,
(P)NU-Prolog, Parlog or (Flat) GHC (the if-then-else construct I use has
to be restricted for the latter two).

>NU Prolog these days has two type checkers that I know of
There are three that are currently being combined into one system, plus
some others....

>Prolog-as-we-know-it is not higher order, but that doesn't stop me using
>maplist and such things in Prolog

My system has some basic things like apply defined.
Prolog-as-we-know-it has call and univ/functor+arg, which is all you
need.

	lee
Technical Details
Message-ID: <2754@munnari.oz.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!munnari.oz.au!lee
References: <11500018@hpldola.HP.COM> <2743@munnari.oz.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!munnari.oz.au!lee
From: lee@munnari.oz.au (Lee Naish)
Newsgroups: comp.lang.prolog
Subject: Re: Fun. vs. Logic
Message-ID: <2754@munnari.oz.au>
Date: 20 Nov 89 05:07:40 GMT
References: <11500018@hpldola.HP.COM> <2743@munnari.oz.au>
Sender: news@cs.mu.oz.au
Reply-To: lee@munmurra.UUCP (Lee Naish)
Organization: Comp Sci, University of Melbourne
Lines: 41