🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #4235

Re: Programs as data

#4235
From: Raul Rockwell
Date: Sat, 29 Jun 1991 02:50
31 lines
1948 bytes
Michael Coffin:
   Prolog almost entirely lacks explicit control structures, which are
   everywhere in conventional languages.

   And unless you are willing to give up explicit control structures,
   things are much more difficult than Prolog.  You have to devise
   ways to represent not just infix notation, which has a fairly
   natural tree representation, but while statements, case statements,
   for loops, blocks, procedures, exit statements, ---the list goes
   on.

There is no reason these things can't be expressed as functions and/or
meta-functions.  For example, a case statement may be represented as a
meta-function which takes two arguments:  (1) a list of function
representations and (2) a selection argument.

Blocks are even simpler -- use the same notation you use to describe
data and pass the results to a meta-function which returns a usable
function.

There are a number of ways to construct for/while loops, ranging from
repeated application of a function to some data (similar to
"foreach"), to a more explicit iteration where you supply a predicate
to determine when the loop is complete.

I'll agree (in advance) that you'll want some sort of meta-function
syntax so that you can take functions as arguments, but that need not
be complex.

-- 
Raul <rockwell@socrates.umd.edu>
Technical Details
Message-ID: <ROCKWELL.91Jun28215035@socrates.umd.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!europa.asd.contel.com!gatech!udel!haven.umd.edu!socrates.umd.edu!socrates!rockwell
References: <4671@optima.cs.arizona.edu> <1991Jun28.133708.3776@watserv1.waterloo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!europa.asd.contel.com!gatech!udel!haven.umd.edu!socrates.umd.edu!socrates!rockwell
From: rockwell@socrates.umd.edu (Raul Rockwell)
Newsgroups: comp.lang.misc
Subject: Re: Programs as data
Message-ID: <ROCKWELL.91Jun28215035@socrates.umd.edu>
Date: 29 Jun 91 02:50:35 GMT
References: <4671@optima.cs.arizona.edu> <1991Jun28.133708.3776@watserv1.waterloo.edu>
Sender: rockwell@socrates.umd.edu (Raul Rockwell)
Organization: Traveller
Lines: 31
In-Reply-To: mhcoffin@tolstoy.waterloo.edu's message of 28 Jun 91 13: 37:08 GMT