Article View: comp.lang.functional
Article #649Re: Why curry? (Re: Why functional languages?)
From: david carlton
Date: Mon, 05 Oct 1992 18:08
Date: Mon, 05 Oct 1992 18:08
33 lines
2518 bytes
2518 bytes
In article <TMB.92Oct4181821@arolla.idiap.ch>, tmb@arolla.idiap.ch (Thomas M. Breuel) writes:
> Why _do_ people continue to use curried syntax when they just want a
> function with several arguments? It's difficult to optimize for the
> compiler, it gives uninformative type signatures (is "'a -> 'a -> 'a"
> intended to be a function of one argument returning a function, or is
> it intended to be a function of two arguments returning a "'a"?), it's
> not what most programmers are used to, and it seems to be difficult to
> indent automatically as well.
Why does SML support functions of multiple arguments using both tuples
and curried functions, anyways? Strikes me as more of a pain than
anything else - some library functions call for functions that use
tuples for multiple arguments, some want curried functions, etc., and
things would be simpler if there were one standard way to do it. Is
this simply a historical carry-over, or is there some better reason?
And how much of a problem is it in practice? I've only programmed a
little in SML, and while it was a bit of a problem, it wasn't too much
of a problem for what I was doing; but I could imagine that it could
be more of one in some situations.
Also, what sorts of order-of-evaluation constraints does SML impose?
If you are compiling "f g h", say, and the compiler can't prove that
evaluating "f g" won't have side effects, does it have to evaluate
"f g" before evaluating "h"? And is it required to evaluate "f"
before "g"?
david carlton
carlton@husc.harvard.edu
If a person is FAMOUS in this country, they have to go on the
ROAD for MONTHS at a time and have their name misspelled on the
SIDE of a GREYHOUND SCENICRUISER!!
Technical Details
Message-ID:
<CARLTON.92Oct5110856@scws8.harvard.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!ogicse!das-news.harvard.edu!husc-news.harvard.edu!husc-news!carltonReferences:
<TMB.92Sep28144424@arolla.idiap.ch> <annius.717696151@freyr> <TMB.92Sep28223555@arolla.idiap.ch> <26463@castle.ed.ac.uk> <BvGz2u.2rv.1@cs.cmu.edu> <NICKH.92Oct2134230@VOILA.VENARI.CS.CMU.EDU> <TMB.92Oct4181821@arolla.idiap.ch>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!das-news.harvard.edu!husc-news.harvard.edu!husc-news!carlton From: carlton@scws8.harvard.edu (david carlton) Newsgroups: comp.lang.functional Subject: Re: Why curry? (Re: Why functional languages?) Message-ID: <CARLTON.92Oct5110856@scws8.harvard.edu> Date: 5 Oct 92 18:08:56 GMT Article-I.D.: scws8.CARLTON.92Oct5110856 References: <TMB.92Sep28144424@arolla.idiap.ch> <annius.717696151@freyr> <TMB.92Sep28223555@arolla.idiap.ch> <26463@castle.ed.ac.uk> <BvGz2u.2rv.1@cs.cmu.edu> <NICKH.92Oct2134230@VOILA.VENARI.CS.CMU.EDU> <TMB.92Oct4181821@arolla.idiap.ch> Organization: Citizens for Boysenberry Jam Lines: 33 Nntp-Posting-Host: scws8.harvard.edu In-reply-to: tmb@arolla.idiap.ch's message of 4 Oct 92 22:18:21 GMT