Article View: comp.lang.functional
Article #668Re: Why functional languages?
From: Rainer Joswig
Date: Wed, 07 Oct 1992 13:42
Date: Wed, 07 Oct 1992 13:42
31 lines
1539 bytes
1539 bytes
In article <26463@castle.ed.ac.uk>, jamesh@castle.ed.ac.uk (James Hammerton) wrote: > Nor to me, but I think that it is a bad example to use anyway. So lets > try something to show the readability a bit better. Consider the > factorial function. In scheme it would be: > > (define fac > (lambda (n) > ( if (= 0 n) > 1 > (* n (fac (- n 1)))))) > > Is that enough brackets?! ;-) > > In SML: > > fun fac 0 = 1 [ or fun fac n = if n=0 then 1 else n*fac(n-1); ] > | fac n = n * fac (n-1) ; > Well, you are comparing apple and oranges :-). Your Lisp example doesn't use pattern matching. There are macros for lisp (like the SELECT-MATCH macro for Common Lisp) which will implement SML style pattern matching. The your lisp code will look very different. Rainer Joswig Email: joswig@informatik.uni-hamburg.de
Technical Details
Message-ID:
<joswig-071092143735@kimac8.informatik.uni-hamburg.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!haven.umd.edu!darwin.sura.net!Sirius.dfn.de!news.DKRZ-Hamburg.DE!rzsun2.informatik.uni-hamburg.de!kimac8.informatik.uni-hamburg.de!userReferences:
<TMB.92Sep28144424@arolla.idiap.ch> <annius.717696151@freyr> <TMB.92Sep28223555@arolla.idiap.ch> <26463@castle.ed.ac.uk>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.functional Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!haven.umd.edu!darwin.sura.net!Sirius.dfn.de!news.DKRZ-Hamburg.DE!rzsun2.informatik.uni-hamburg.de!kimac8.informatik.uni-hamburg.de!user From: joswig@informatik.uni-hamburg.de (Rainer Joswig) Subject: Re: Why functional languages? Message-ID: <joswig-071092143735@kimac8.informatik.uni-hamburg.de> Followup-To: comp.lang.functional Sender: news@informatik.uni-hamburg.de (Mr. News) Organization: University of Hamburg, FRG References: <TMB.92Sep28144424@arolla.idiap.ch> <annius.717696151@freyr> <TMB.92Sep28223555@arolla.idiap.ch> <26463@castle.ed.ac.uk> Date: Wed, 7 Oct 92 13:42:46 GMT Lines: 31