Article View: comp.lang.functional
Article #651Re: Why curry? (Re: Why functional languages?)
From: david carlton
Date: Tue, 06 Oct 1992 00:17
Date: Tue, 06 Oct 1992 00:17
31 lines
2380 bytes
2380 bytes
In article <NICKH.92Oct5160904@VOILA.VENARI.CS.CMU.EDU>, nickh@CS.CMU.EDU (Nick Haines) writes:
> In article <CARLTON.92Oct5110856@scws8.harvard.edu> carlton@scws8.harvard.edu (david carlton) writes:
>> Why does SML support functions of multiple arguments using both tuples
>> and curried functions, anyways?
> 1. All functions in SML take one argument. Thinking of "functions of
> multiple arguments" results in confusion of the sort you show in your
> questions.
Sure, I understand that; and if I wanted to define functions taking
multiple arguments which were implemented by lists or some other
method, I could. It's just that the language itself supports tuples
and curried functions more than it does other ways of implementing
multiple arguments. For example, there is special syntax for writing
curried functions; if you convert an infix function to a prefix
function, you get a function taking a 2-tuple as an argument; various
library functions use the one form or the other for multiple arguments
or accept functional arguments using the one form or the other;
various library functions taking multiple arguments even come with
both a curried version of the function and a tuple version of the
function. (I'm not familiar enough with the language to know whether
or not those last two are part of the language definition, but their
existence in some implementations shows that this is an issue.) So
it's more complicated than just saying "All functions in SML take one
argument."
david carlton
carlton@husc.harvard.edu
Did I do an INCORRECT THING??
Technical Details
Message-ID:
<CARLTON.92Oct5201708@scws4.harvard.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!know!hri.com!spool.mu.edu!caen!kuhub.cc.ukans.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> <CARLTON.92Oct5110856@scShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!know!hri.com!spool.mu.edu!caen!kuhub.cc.ukans.edu!husc-news.harvard.edu!husc-news!carlton From: carlton@scws4.harvard.edu (david carlton) Newsgroups: comp.lang.functional Subject: Re: Why curry? (Re: Why functional languages?) Message-ID: <CARLTON.92Oct5201708@scws4.harvard.edu> Date: 6 Oct 92 00:17:08 GMT 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> <CARLTON.92Oct5110856@sc Organization: Citizens for Boysenberry Jam Lines: 31 Nntp-Posting-Host: scws4.harvard.edu In-reply-to: nickh@CS.CMU.EDU's message of Mon, 5 Oct 1992 21:09:04 GMT