From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 47CC37EE1C for ; Fri, 30 Nov 2012 17:02:04 +0100 (CET) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.223.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.223.182 as permitted sender) identity=mailfrom; client-ip=209.85.223.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ie0-f182.google.com) identity=helo; client-ip=209.85.223.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-ie0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiIBADjYuFDRVd+2mGdsb2JhbABEg2SpZpI7CBYOAQEBAQEICQ0HFCeCHgEBBAEnGQEbDAYLAQMBCwYFCwMKDSEiAREBBQEKEgYTEodrAQMJBgcFoRKMM4J6hQsKGScDClmIdQEFDIw0hEEDlgCBHIgugW2DLRYphBQ X-IronPort-AV: E=Sophos;i="4.84,191,1355094000"; d="scan'208";a="184016714" Received: from mail-ie0-f182.google.com ([209.85.223.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 30 Nov 2012 17:01:38 +0100 Received: by mail-ie0-f182.google.com with SMTP id s9so1512397iec.27 for ; Fri, 30 Nov 2012 08:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=uVGuvKD832Zqi+D1n0BAVjyOxgTVV/w3ykEpoT5kGtA=; b=uEByB4U/Q2j5gl+OUh6gsulZuxjJtnJjRKj8C07IYdEyS73nHgxjofdoH7AblPZZpH iLZ6KB7hdllpV2Fxia5rur9q7A4HlHswqgYr1XaZb7GgSoFFvLGrnv3pGzCg6X6BbpCg tqhcf5ZR1qU9KZjS4Hs7L5TOc8whfs3IHoxkQlu0xkuIYcWsQa4gL3lFjHtyx+ci2iKR KGt4NZhIa6hOQ+RmESWhulcGewGaJzuF/Luw/QhAEgw3q51S8J5BLaRnucU3PSbTrWrl i18+CrIyOC4gjIksFp/fQzsODXz9kls+pbk1Ws18nXhXgsaxjn62tK6hDpkHAlyp/Vly gstg== Received: by 10.50.180.133 with SMTP id do5mr29122989igc.2.1354291297122; Fri, 30 Nov 2012 08:01:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.184.199 with HTTP; Fri, 30 Nov 2012 08:00:56 -0800 (PST) In-Reply-To: <20121130100601.GA27413@upsilon.cc> References: <50B822A6.7000504@emu-bark.com> <20121130100601.GA27413@upsilon.cc> From: Gabriel Scherer Date: Fri, 30 Nov 2012 17:00:56 +0100 Message-ID: To: Stefano Zacchiroli Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] List.fold_left vs. Hashtbl.fold > ... but I'm curious about this "dubious" point. Is it something that has > already been discussed in the context of OCaml and I've missed the > relevant discussion? Or is it something there are results available > elsewhere? Either way, pointers on that would be very much appreciated! My personal issue with Scala syntax is that the scope of the anonymous function is entirely implicit: if you write (li.map(_ + 1)) it will desugar into (li.map (x =3D> x + 1)) (apparently to the first parenthesis level), but (if (_) foo else bar) desugars to (fun x =3D> if x foo bar), and ((_ : Int) + 1) to (fun x =3D> (x : Int) + 1); there is no explicit enclosing boundary, the scope is the "smallest expression that contains the underscore" for some notion of "containing" that I don't find particularly intuitive on the examples above. I think implicit scopes are a "dubious" idea and would really want an explicit construction to mark the scope of these doubly anonymous functions. The problem is that you have to find a really light syntax, as the value of this construction is precisely its concision. In my young years I used to think that Camlp4 syntax extensions could be beneficial, and I wrote an extension for this purpose ( : http://bluestorm.info/camlp4/pa_holes.ml.html ). It allows to write for example (\ \2 \1) for the swap function: (\ ... ) delimits the abstraction scope and variable are written \n (_ would be another compromise: less expressive on the ordering, but shorter). Another upside of these syntax is that they give light thunking for free: proponents of lazy evaluation like the fact that some control construct can be defined as simple functions under a lazy stragy, while writing if b (fun () -> e1) (fun () -> e2) is too painful to be viable in ML. Well, if b (\ e1) (\ e2) (using the convenition that there is always at least one parameter) is bett= er. > And thanks for your efforts in fueling language design discussion on > this list!, I really appreciate it and the resulting discussions. It's a double-edged sword: it's easy to get lost in mundane details or ultimately void debates about "the next programming language" on a list that is really about OCaml users. I wasn't sure already that discussion of Scala's implicit function syntax was in-topic, but well. I'll try to keep my side of the discussion not too long. Daniel B=FCnzli wrote: > I have the *impression* that currying is essential when you want to devis= e dsls and combinators that integrate naturally in the host language. But I= may be wrong. I don't know. "function application is just space" is indeed a convenient syntax to emulate other syntaxes (for example embed a concatenative language through cunning continuation-passing-style), but that doesn't need to go away with non-currified functions, which is about applying all arguments, not necessarily forcing a tupled syntax. Only partial application would be less convenient (but you can still explicitly define functions-that-return-functions). That would certainly need more experimentation. On Fri, Nov 30, 2012 at 11:06 AM, Stefano Zacchiroli wrot= e: > On Fri, Nov 30, 2012 at 10:53:21AM +0100, Gabriel Scherer wrote: >> My personal opinion is that currying is overrated > > Very much agreed! > >> and we should think about language design without currying, and with a >> nice short syntax for partial application (inspired by Scala's >> admittedly dubious (foo _ bar) syntax for (fun x -> foo x bar)). > > ... but I'm curious about this "dubious" point. Is it something that has > already been discussed in the context of OCaml and I've missed the > relevant discussion? Or is it something there are results available > elsewhere? Either way, pointers on that would be very much appreciated! > > And thanks for your efforts in fueling language design discussion on > this list!, I really appreciate it and the resulting discussions. > > Cheers. > -- > Stefano Zacchiroli . . . . . . . zack@upsilon.cc . . . . o . . . o . o > Ma=EEtre de conf=E9rences . . . . . http://upsilon.cc/zack . . . o . . . = o o > Debian Project Leader . . . . . . @zack on identi.ca . . o o o . . . o . > =AB the first rule of tautology club is the first rule of tautology club = =BB > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs