Xref: utzoo comp.lang.prolog:2149 comp.lang.scheme:917 Path: utzoo!attcan!uunet!aplcen!samsung!cs.utexas.edu!rice!titan!dorai From: dorai@titan.rice.edu (Dorai Sitaram) Newsgroups: comp.lang.prolog,comp.lang.scheme Subject: Re: Fun. vs. Logic Message-ID: <3055@brazos.Rice.edu> Date: 19 Nov 89 20:03:49 GMT References: <11500018@hpldola.HP.COM> <11610@phoenix.Princeton.EDU> Sender: root@rice.edu Reply-To: dorai@titan.rice.edu (Dorai Sitaram) Followup-To: comp.lang.prolog Organization: Rice University, Houston Lines: 69 Mark, I have cross-posted to comp.lang.scheme. If there is lack of interest in comp.lang.prolog (since I have digressed from the subject-line "Fun. vs. Logic"), you may consider restricting distribution to comp.lang.scheme. Here goes... In article <11610@phoenix.Princeton.EDU> markv@phoenix.Princeton.EDU (Mark T Vandewettering) writes: >In article <11500018@hpldola.HP.COM> patch@hpldola.HP.COM (Pat Chkoreff) writes: >>These detract from the >>value of a Prolog program as a mathematical specification. The only impure >>constructs I've seen in functional programming are exceptions and >>destructive assignment, and these are very rarely used. > >AIIIGH! The horror! ASSIGNMENT? > >Exceptions are not necessarily a non-functional construct, it is >relatively simple to design a moderately effective exception handling >mechanism if you adopt a language in which continuations are first >class. > >Destructive assigment is an atrocity, and totally against the spirit of >functional programming, neatly messing up lots of nice properties. I am >for a language without the crutch of assignment. I have two questions for you, as I consider both continuations and assignment imperative, i.e., extrafunctional features. (I use "extrafunctional" non-pejoratively, since I have been caught using said features without qualms. :-]) @ Why are exceptions (and continuations) "not necessarily non-functional"? I'd like to know the metric you use to judge "functionalness." @ If, by your definition of "functionalness," continuations turn out to be functional, then why are assignments denied the same privilege? In other words, what are the nice properties of "functionalness" that are violated by assignment but preserved by adding first-class continuations. (I concur with you that continuations and assignment affect a functional language in remarkably different ways: which is but natural, since they are two distinct extensions to the base language.) >... >Two features of Prolog are particularly outstanding: backtracking, and >logic variables. ... > >Each family have interesting strengths, and provide a rich environment >for future research. In particular, I believe these two families >provide the most hope for effective parallel implementation. It is probably only moderately well-known that a functional language with extrafunctional facilities like assignment and continuations can fairly easily embed (note: "embed" is better than "model") a logic programming language with extralogical facilities such as Prolog. The literature on this subject (i.e., embedding only, _not_ suggested combinations of log+fun, which are rife) is confined to two short but interesting papers, one by Chris Haynes and the other by Matthias Felleisen, and probably one by Srivastava, Oxley & Srivastava which I haven't seen. It might be interesting to see if the gulf has been bridged from the other side, i.e., embedding (functional + assignment + continuations) in a (logic + cut) language. --dorai -- ------------------------------------------------------------------------------- It may be that the gulfs will wash us down; It may be we shall touch the Happy Isles. -------------------------------------------------------------------------------