Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!teknowledge-vaxc!sri-unix!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Funcy - an implementation of FP in Prolog. (long) Message-ID: <266@quintus.UUCP> Date: 9 Aug 88 21:17:51 GMT References: <1165@ttds.UUCP> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 22 In article <1165@ttds.UUCP> jonasn@ttds.UUCP (Jonas Nygren) writes: >Question: Can anybody answer me whether it would be possible to do an > efficient implementation of funcy/3, @ a s o as Prolog built-ins > or is FP doomed to remain a toy? I don't know what '@ a s o ...' means. It shouldn't be any harder to base FP on Prolog than on Lisp, so you should be able to do about as well as the FP system described in the BSD UNIX manuals. It should be straightforward to just compile FP forms into Prolog, using the technique of partially executing an interpreter. However, that has two problems: FP only has one data structuring form, namely lists, so you'd be wasting space compared with "native" Prolog representations of data using compound terms, and the naive method tends to produce a lot of intermediate data structures. There's a fair literature on transforming FP programs to more efficient forms, all of which should be applicable. For example, if you form a list of pairs and then feed that into something which applies a binary function to each pair, you want to move the binary function into the code that generates the pairs, so that you can avoid storing them. If there is a fast implementation of FP anywhere, I'd like to hear of it.