From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id BAA03161; Wed, 11 Apr 2001 01:37:05 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA03153 for ; Wed, 11 Apr 2001 01:37:04 +0200 (MET DST) Received: from mail.mimuw.edu.pl (pf11.warszawa.ppp.tpnet.pl [212.160.57.11]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f3ANaRb08045 for ; Wed, 11 Apr 2001 01:36:38 +0200 (MET DST) Received: (from news@localhost) by mail.mimuw.edu.pl (PLD/8.9.3) id BAA18053 for caml-list@inria.fr; Wed, 11 Apr 2001 01:16:23 +0200 X-Authentication-Warning: qrnik.zagroda: news set sender to qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk) using -f From: qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk) Subject: Re: [Caml-list] variant with tuple arg in pattern match? Date: 10 Apr 2001 23:16:19 GMT Organization: Klub Nieszkodliwych =?iso-8859-2?Q?Manjak=F3w?= Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Trace: qrnik.zagroda 986944579 18051 192.168.0.1 (10 Apr 2001 23:16:19 GMT) X-Complaints-To: news@qrnik.zagroda NNTP-Posting-Date: 10 Apr 2001 23:16:19 GMT User-Agent: slrn/0.9.6.3 (Linux) To: caml-list@inria.fr Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Tue, 10 Apr 2001 18:25:27 +0100, Dave Berry pisze: > There are two levels of semantics here. At the higher level, we have > the behaviour that the programmer is trying to communicate, which > distinguishes returning a function as a result on the one hand from > passing multiple arguments on the other. Sometimes it distinguishes that, sometimes not. Cases when they are not distinguished seems to be common among functions taking functions as *arguments*. Consider let flip f x y = f y x How would you write it in the uncurried style? let flip (f,x,y) = f y x let flip (f,x,y) = f (y,x) let flip f = fun (x,y) -> f y x let flip f = fun (x,y) -> f (y,x) let flip (f,x) -> fun y -> f y x let flip (f,x) -> fun y -> f (y,x) It tries to distinguish too much. flip transforms a binary function to a function which takes its arguments in the opposite order. flip transforms a multi-argument function to let it take its first two arguments in the opposite order. flip takes a binary function with its second argument and returns the appropriate partial application. flip takes a binary function and its arguments and applies the function to the arguments in the opposite order. All these interpretations are correct. They describe the same thing in different ways. I see no point in being forced to distinguish them. > The lower level is how this is encoded in the programming language. > With currying, there is no difference between the two, so information > has been lost. With multiple arguments, the distinction is > maintained. I would say the opposite. The uncurried style requires to introduce some grouping of arguments. This grouping is not necessarily inherent to the problem at hand. The concrete syntax introduced an unnecessary distinction. -- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTĘPCZA QRCZAK ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr