🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #4301

Re: PROLOG in the "real" world?

#4301
From: Charles Lin
Date: Mon, 07 Oct 1991 13:37
41 lines
3412 bytes
In article <1991Oct4.173827.14992@athena.cs.uga.edu>, mcovingt@athena.cs.uga.edu (Michael A. Covington) writes:
> In article <1991Oct04.142838.29652@eng.umd.edu> clin@eng.umd.edu (Charles Lin) writes:
> 
> > [...] For example, in Pascal,
> >a beginner might ask what happens to the original variable values passed in
> >when a recursive call is made.  It is useful, to my mind, to say that the
> >function "stores" away these values for later use.  But then, perhaps, I, too,
> >have been brainwashed by the process.
> 
> Yes, you've been a bit "brainwashed" by thinking of variables as boxes in
> which to store things.  The way I explain it to beginners is that the machine
> creates "a new copy" of the procedure, containing the same instructions but
> totally non-conflicting variables. (Actually only the stack frame is copied,
> but that's a detail of implementation.)  The procedure says _how_ to do
> things; the storage of variables is a separate issue.
> 
> Recursion is easier to introduce using examples where there are no variables
> except for the arguments to procedures.  This kind of example is more
> abundant in Prolog and Lisp than in other languages.
> 

    Hmm, intriguing idea.  So, you've come up with a model of recursion, which,
is not strictly the way recursion works, but operationally equivalent.  A lot
of CS seems to work that way.  There are cases where I've felt the way that
something was implemented made things clearer.  I know I thought that about
recursion, but you seem to have come up with another way of explaining the idea
of recursion without talking about a stack.  Another example where I thought
knowing some implementation details made the concept easier to follow was
semaphores.

    While I personally like the idea of recursion and use it whenever I program
in LISP, I am curious to other reasons of using recursion besides elegance.

--
   ______    __    __   ___  ____
  / ____ \  |  |  |__| |   \ |  |    Charles Lin
 | /    \_| |  |   __  |    \|  |    e-mail: clin@eng.umd.edu
 | |        |  |  |  | |  |\    |   
 | |     _  |  |  |__| |__| \___|    University of Maryland
 | \____/ | |  |____                 "I hate big sigs." -- Moo
  \______/  \_______|
Technical Details
Message-ID: <1991Oct07.133749.15786@eng.umd.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!europa.asd.contel.com!darwin.sura.net!haven.umd.edu!mimsy!mojo.eng.umd.edu!eng.umd.edu!clin
References: <1991Oct02.193655.16492@chome.ruhr.de> <1991Oct3.180209.3023@athena.cs.uga.edu> <1991Oct04.142838.29652@eng.umd.edu> <1991Oct4.173827.14992@athena.cs.uga.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f43e6,2ad8401e5c040397
X-Google-Attributes: gidf43e6,public
X-Google-Thread: f907c,2ad8401e5c040397
X-Google-Attributes: gidf907c,public
X-Google-Thread: 10461e,2ad8401e5c040397
X-Google-Attributes: gid10461e,public
X-Google-Thread: 10db24,2ad8401e5c040397
X-Google-Attributes: gid10db24,public
X-Google-Thread: 102449,2ad8401e5c040397
X-Google-Attributes: gid102449,public
X-Google-ArrivalTime: 1991-10-07 13:16:05 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!europa.asd.contel.com!darwin.sura.net!haven.umd.edu!mimsy!mojo.eng.umd.edu!eng.umd.edu!clin
From: clin@eng.umd.edu (Charles Lin)
Newsgroups: comp.lang.prolog,comp.software-eng,comp.edu,comp.ai,aus.ai
Subject: Re: PROLOG in the "real" world?
Message-ID: <1991Oct07.133749.15786@eng.umd.edu>
Date: 7 Oct 91 13:37:49 GMT
References: <1991Oct02.193655.16492@chome.ruhr.de> <1991Oct3.180209.3023@athena.cs.uga.edu> <1991Oct04.142838.29652@eng.umd.edu> <1991Oct4.173827.14992@athena.cs.uga.edu>
Sender: clin@eng.umd.edu (Charles Chien-Hong Lin)
Organization: College of Engineering, University of Maryland, College Park
Lines: 41