Practicality of functional and logic languages?

lock@karlsruhe.gmd.de
Thu, 14 Jan 1993 10:44:08 GMT

          From comp.compilers

Related articles
Practicality of functional and logic languages? benes@dcse.fee.vutbr.cs (Mirek Benes) (1993-01-11)
Re: Practicality of functional and logic languages? eifrig@beanworld.cs.jhu.edu (1993-01-12)
Re: Practicality of functional and logic languages? tobbe@erix.ericsson.se (1993-01-12)
Re: Practicality of functional and logic languages? maniattb@cs.rpi.edu (1993-01-12)
Re: Practicality of functional and logic languages? torbenm@diku.dk (1993-01-13)
Re: Practicality of functional and logic languages? hdev@dutiai.twi.tudelft.nl (1993-01-13)
Practicality of functional and logic languages? lock@karlsruhe.gmd.de (1993-01-14)
Re: Practicality of functional and logic languages? nickh@CS.CMU.EDU (1993-01-14)
Re: Practicality of functional and logic languages? joe@erix.ericsson.se (1993-01-14)
Re: Practicality of functional and logic languages? aet@mundil.cs.mu.OZ.AU (1993-01-15)
Re: Practicality of functional and logic languages? johnson@cs.uiuc.edu (1993-01-15)
Re: Practicality of functional and logic languages? glew@pdx007.intel.com (1993-02-03)
| List of all articles for this month |

Newsgroups: comp.compilers
From: lock@karlsruhe.gmd.de
Organization: Compilers Central
Date: Thu, 14 Jan 1993 10:44:08 GMT
References: 93-01-059
Keywords: functional, logic

benes@dcse.fee.vutbr.cs (Mirek Benes) writes:
> I would like to know some opinions concerning functional and logic
> programming languages (Haskell, Miranda, ML / Prolog) and their practical
> usability for programming: ...........


Well, since I have been working with declarative languages for a decade, I
would like to give my opinions and some informative contributions.


Concerning functional and logic programming languages (Haskell, SML /
Prolog ... ):


1) They are definitely a practical means for teaching comuter science.
The functional logic language GTML has been used at Univ. Karlsruhe for
teaching undergrads basic concepts in programming, such as:
       data structurs, e.g. lists, trees, sets, ...
data abstraction, ADT's
algebraic laws, transformation
recursion (functional programming)
test-and-generate (complete search)
strong typing, polymorphism, and module systems


Goofer, a variant of Haskell, is now being used at the Techn. Uni Berlin
(Prof. S. Jaehnichen in teaching undergrads. Goofer offers additionally
object oriented concepts and more expressiveness to form data abstraction.


Using a declarative languge instead of C, Modula, or Pascal purifies
teaching the basic concepts. The problem with C and others is often that
exercises become quickly blurred by pointer manipulation and such
imperative features.


2) In academic environments, we find an intersting number of non-trivial
applications of functional and logic languages. Examples are:
prototype implementations of new languages
compilers (not only prototypes, but also realistic ones, the
best example is the New Jersey SML compiler written in SML).
compiler generation systems (the GENTLE system developed at
GMD research lab at Univ. Karlsruhe)
emacs, written in LISP
computer linguistics (the LILOG project at IBM research in
Heidelberg (FRG))
...


3) Yes, there is an increasing number of industrial applications. For
logic programming, I may refer to the special issue of the Journal of
Logic Programming, March 1990. Furthermore, Prolog has become a strategic
product of IBM and will therefore receive full support over at least a
decade. At IBM research in Heidelberg (FRG) we are developping industrial
production planning systems on the base of an extended logic programming
system, PROTOS-L. The system has a comfortable OSF/Motif interface, a
database interface to ORACLE, and an integrated constraint solver. At
Siemens (Munich) they use constraint logic programming for circuit design
verification and for deriving switching code (for control devices) from
logic specifications. Such powerful declarative systems offer a good base
for large applications with decrased development times, better maintenance
facilities, and therefore lower production costs.


A simple scheduling system, for instance, has been implemented in our team
within half a year by two people, and its core is highly reusable for
several other planning applications.
    Examples of such powerful systems which are used in industrie are:
        CHIP (developed at ECRC, Munich and distributed now by COSYTEC, Paris),
        SEPIA (Siemens), DecisionPower (ICL? or Bull, a descendent of CHIP),
        PROLOG III (Prof. Colmerauer, Marseille, see special issue in CACM 7/90)
            CLP(R) (Watson research center, IBM, Yorktwon Heights, USA),
      [to mention only the most known ones, see further in CACM 7/90].
A couple of industrail applications ahve been reported in the
proceedings of the Logic Programming Summer School, Z"urich 1992, appeared
in LNAI, Springer '92.


As concerns functional programming, the situation is not yet as clear as
that (except for LISP, which is widely in use). The language HOPE has been
sponsored quite a couple of years by ICL. We should take into account
that Prolog, and thus logic programming, came into the universities a
decade earlier, und thus is now better established in most heads than
functional programming (at least this can be taken as the european
viewpoint).


4) Performance: can be extremely good. Examples are the work of Peter van
Roy (now at DEC research, Paris) on compiling Prolog to stock hardware
(RISC) (there has been an article in 'Computer'), my own thesis on
compiling functional + logic languges, the work of S. Peyton-Jones on
compiling lazy functional languages, and the New Jersey Standard ML
Compiler system (to mention just a few). The major idea of all these
approaches is to employ as much as possible of the classical compilation
techniques for imperative languges. The results are encouraging:
performance is often better than for commercial systems, and only a factor
of 2-6 away from handwritten C-code (in some cases even better due to
radical tail recursion elimination).






To conclude and answer Mirek Benes' questions :


- research in functional and logic programming now comes to a cumulative
point where the declarative paradigm is mature for commercial and
commercial use. However, research will go on (never-ending) since their
principles are much more concerned with the foundations of computing than
this is the case for imperative languages (which can be seen as a smart
abstraction of the von Neumann architecture).


- there are definitely successful applications written in such languages,
most of them still in universities and research labs, but an increasing
number in the rest of the universe (Siemens, BNR, Boing, ...). CHIP seems
to be an example of a comercial success (Note, CHIP involved only 8 years
from basic research to market).


- their performance can compete with "imperative" solutions, but the costs
and times in development, implementing, maintaining, and reusing them are
considerable smaller (a point which interests the management).


Hendrik C.R. Lock


--------- Email: lock@karlsruhe.gmd.de
Institute for Knowledge Based Systems or: lock@dhdibm1.bitnet
IBM -- Systems and Software -- WZH --
Vangerowstrasse 18 POB 103068 Phone: +6221 - 594490
6900 Heidelberg (FRG)
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.