🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #2295

Re: "Embedded Prolog" in C code

#2295
From: Aaron Sloman
Date: Tue, 11 Jun 1991 00:09
65 lines
3830 bytes
ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:

> In article <653@fudd.dataco.UUCP>, campbell@dataco.UUCP (Duncan Campbell) writes:
> > Well, Ted, out here in the real world _REAL_ Prolog isn't much use to
> > anyone.  Indeed, if I were required to use a "pure" language, I simply
> > would not bother with prolog at all: Scheme _IS_ a far superior language.
>
> I'm currently using Scheme a lot.  I have three observations to make
> about Scheme.
> (1) I like it.
> (2) One day it will catch up with where Pop-2 was years ago, but
>     don't hold your breath.  (Scheme has precisely two things that
>     Pop-2 didn't:  lexical scoping and full continuations.  These
>     days Pop has lexical scoping.)
> ....

Just for the record: Poplog Pop-11 also has processes, which give
much of the power of continuations. In particular the procedure
consproc_to can be used to save the state of computation up to
some point in the current control stack. The saved state is stored
in a data-structure that can be re-activated at any time thereafter.

More precisely, here's the definition in the Poplog REF files.

consproc_to(ITEM_1, ..., ITEM_N, N, TARGET_P) -> PROC
consproc_to(ITEM_1, ..., ITEM_N, N, TARGET_P, VOLATILE) -> PROC
        Makes the current  calling sequence upto  and including the  the
        most recent  call  of the  procedure  TARGET_P into  a  process,
        returning the process record PROC for the new (running) process.
        This  procedure  effectively  'inserts'  a  call  of   -runproc-
        immediately above the  call of TARGET_P,  does a -suspend-,  and
        then immediately  runs the  process again  with PROC  passed  as
        argument.
            The implicit -suspend- automatically subsumes any  processes
        running below the  call of TARGET_P;  these will be  reactivated
        when PROC is run again.
            The user stack of PROC is then set to contain N items passed
        from the current stack (i.e. the stack as it is AFTER suspending
        intervening  processes).   To   allow   computation   (in   that
        environment) of the number of items to be passed, the argument N
        may also be a  procedure which returns the  number, i.e. N()  is
        evaluated after suspending intervening processes.

        VOLATILE is an optional  boolean argument specifying whether the
        process is  volatile or  not (see below).  If not  specified the
        default is true, i.e. volatile.

Note that a process can be 'volatile' or 'non-volatile'. With a volatile
process, the  saved state held  in the process  record is lost  when the
process is run, so that the  record is effectively empty until such time
as the  process suspends again.  With a non-volatile process,  the saved
state (as it was  at the time of running) is  retained until the process
is next suspended.

-------------------------------------------------------------------

consproc_to, like much of Poplog, was designed and implemented by
John Gibson.


Aaron Sloman,
School of Cognitive and Computing Sciences,
Univ of Sussex, Brighton, BN1 9QH, England
    EMAIL   aarons@cogs.sussex.ac.uk
[Birmingham University from August 1991]
Technical Details
Message-ID: <5324@syma.sussex.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!icdoc!syma!aarons
References: <1991May26.231138.13000@brolga.cc.uq.oz.au> <644@fudd.dataco.UUCP> <653@fudd.dataco.UUCP> <6199@goanna.cs.rmit.oz.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!icdoc!syma!aarons
From: aarons@syma.sussex.ac.uk (Aaron Sloman)
Newsgroups: comp.lang.prolog
Subject: Re: "Embedded Prolog" in C code
Keywords: continuations, scheme, pop-2, pop-11
Message-ID: <5324@syma.sussex.ac.uk>
Date: 11 Jun 91 00:09:36 GMT
References: <1991May26.231138.13000@brolga.cc.uq.oz.au> <644@fudd.dataco.UUCP> <653@fudd.dataco.UUCP> <6199@goanna.cs.rmit.oz.au>
Organization: School of Cognitive & Computing Sciences, Sussex Univ. UK
Lines: 65