Article View: comp.lang.prolog
Article #4300Re: PROLOG in the "real" world?
From: Michael A. Covington
Date: Fri, 04 Oct 1991 17:38
Date: Fri, 04 Oct 1991 17:38
26 lines
2325 bytes
2325 bytes
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. -- ================================================================== Michael A. Covington, Ph.D. | mcovingt@uga.cc.uga.edu | N4TMI Assistant to the Director, Artificial Intelligence Programs The University of Georgia, Athens, Georgia 30602, U.S.A.
Technical Details
Message-ID:
<1991Oct4.173827.14992@athena.cs.uga.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!samsung!emory!athena.cs.uga.edu!mcovingtReferences:
<1991Oct02.193655.16492@chome.ruhr.de> <1991Oct3.180209.3023@athena.cs.uga.edu> <1991Oct04.142838.29652@eng.umd.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10461e,2ad8401e5c040397 X-Google-Attributes: gid10461e,public X-Google-Thread: f907c,2ad8401e5c040397 X-Google-Attributes: gidf907c,public X-Google-Thread: 102449,2ad8401e5c040397 X-Google-Attributes: gid102449,public X-Google-Thread: f43e6,2ad8401e5c040397 X-Google-Attributes: gidf43e6,public X-Google-Thread: 10db24,2ad8401e5c040397 X-Google-Attributes: gid10db24,public X-Google-ArrivalTime: 1991-10-05 03:50:32 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!samsung!emory!athena.cs.uga.edu!mcovingt From: mcovingt@athena.cs.uga.edu (Michael A. Covington) Newsgroups: comp.lang.prolog,comp.software-eng,comp.edu,comp.ai,aus.ai Subject: Re: PROLOG in the "real" world? Message-ID: <1991Oct4.173827.14992@athena.cs.uga.edu> Date: 4 Oct 91 17:38:27 GMT References: <1991Oct02.193655.16492@chome.ruhr.de> <1991Oct3.180209.3023@athena.cs.uga.edu> <1991Oct04.142838.29652@eng.umd.edu> Organization: University of Georgia, Athens Lines: 26