From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 41FA481799 for ; Mon, 22 Jul 2013 13:51:10 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of wojciech.meyer@gmail.com) identity=pra; client-ip=209.85.214.174; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="wojciech.meyer@gmail.com"; x-sender="wojciech.meyer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of wojciech.meyer@gmail.com designates 209.85.214.174 as permitted sender) identity=mailfrom; client-ip=209.85.214.174; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="wojciech.meyer@gmail.com"; x-sender="wojciech.meyer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ob0-f174.google.com) identity=helo; client-ip=209.85.214.174; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="wojciech.meyer@gmail.com"; x-sender="postmaster@mail-ob0-f174.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao0BAJIb7VHRVdauk2dsb2JhbABagztQrg6JaYg5gQYIFg4BAQEBBwsLCRQEJIIkAQEEAScZARsLBwsBAwELBgUEBxohIgERAQUBChIGExKHawEDCQYMmWSMT4J/hA4KGScDCmSHdAEFDJAGBAeDfgOXXYEpjj8WKYQ5Ow X-IPAS-Result: Ao0BAJIb7VHRVdauk2dsb2JhbABagztQrg6JaYg5gQYIFg4BAQEBBwsLCRQEJIIkAQEEAScZARsLBwsBAwELBgUEBxohIgERAQUBChIGExKHawEDCQYMmWSMT4J/hA4KGScDCmSHdAEFDJAGBAeDfgOXXYEpjj8WKYQ5Ow X-IronPort-AV: E=Sophos;i="4.89,718,1367964000"; d="scan'208";a="26867718" Received: from mail-ob0-f174.google.com ([209.85.214.174]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 22 Jul 2013 13:51:09 +0200 Received: by mail-ob0-f174.google.com with SMTP id wd20so8077059obb.33 for ; Mon, 22 Jul 2013 04:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Z9IiQiIsZNEqckFAunQojukWQPnI7mBKJJHb1b5OUKY=; b=v6Vrxt7CNm+0TCYZTG9qrbQM49xqFJqbIaAMyD86CDLLnNNqKE6EuXPs2OphNdKF93 O5NdptYOWnA52LCggBniEG1I8rOgBJUdW96ca047Sd7fs9FX/M7e4KlWsIOIngjMA9eg sNGR9S+qvIwVlTNgxZDqUQFD3ci6mlbHIocmRrL/T3TAUv3o0oupT1UA01JFiWgJZ2Xz 1RDuI1nh4EubCY7r0ip6G0QodJVEke8QAuQ9OXrevVvp3D9GRijQ8f+QFf5gTeOrzfwG XUihl5qz+7Yjitxd+QUDvpM0yBWicC22i3+PuilSXoc2QZ/2Zc67lMQKpMNNl5kAeMyo SqSA== MIME-Version: 1.0 X-Received: by 10.60.131.171 with SMTP id on11mr26193573oeb.71.1374493868389; Mon, 22 Jul 2013 04:51:08 -0700 (PDT) Received: by 10.182.74.65 with HTTP; Mon, 22 Jul 2013 04:51:08 -0700 (PDT) In-Reply-To: <20130722114230.GA2070@siouxsie> References: <20130721225729.5267f17e61a6d904e8e6cc45@gmerlin.de> <20130722114230.GA2070@siouxsie> Date: Mon, 22 Jul 2013 12:51:08 +0100 Message-ID: From: Wojciech Meyer To: oliver Cc: Christopher Zimmermann , Caml List Content-Type: multipart/alternative; boundary=047d7b471da4c57d5104e2184abc Subject: Re: [Caml-list] Re: functional or imperative feature ? --047d7b471da4c57d5104e2184abc Content-Type: text/plain; charset=ISO-8859-1 Moreover we can translate lets to lambdas: let () = print_endline "Foo" in let () = print_endline "Bar" in let () = print_endline "Baz" in () (fun () -> (fun () -> print_endline "Baz") (print_endline "Bar")) (print_endline "Foo") Further transformation to use bind instead of function application and wrapping the carried value into a type, leads to monads. On Mon, Jul 22, 2013 at 12:42 PM, oliver wrote: > Maybe it can be called just syntactical sugar... > > > ======================================================================== > > let fun_a () = print_endline "A: FooBar"; > print_endline "A: Baz" > > let fun_b () = > let () = print_endline "B: FooBar" in > let () = print_endline "B: Baz" in > () > > > > let () = > fun_a(); > fun_b() > > > (* or this one:, of course: > > let () = > let () = fun_a() in > let () = fun_b() in > () > > *) > > ======================================================================== > > > > Ciao, > Oliver > > -- > 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 > --047d7b471da4c57d5104e2184abc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Moreover we can translate lets to lambdas:
=
let () =3D print_endline "Foo" in
let ()= =3D print_endline "Bar" in
let () =3D print_endline &q= uot;Baz" in
=A0 =A0()

(fun () -> (fun () -> print_e= ndline "Baz") (print_endline "Bar")) (print_endline &qu= ot;Foo")

Further transformation to use bind i= nstead of function application and
wrapping the carried value into a type, leads to monads.
On Mon, Jul 22, 2013 at 12:42 PM, oliver <= oliver@first= .in-berlin.de> wrote:
Maybe it can be called just syntactical sugar...


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

let fun_a () =3D print_endline "A: FooBar";
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0print_endline "A: Baz"

let fun_b () =3D
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0let () =3D print_endline "B: FooBar&quo= t; in
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0let () =3D print_endline "B: Baz" = in
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0()



let () =3D
=A0 =A0fun_a();
=A0 =A0fun_b()


(* or this one:, of course:

let () =3D
=A0 =A0let () =3D fun_a() in
=A0 =A0let () =3D fun_b() in
=A0 =A0()

*)

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D



Ciao,
=A0 =A0Oliver

--
Caml-list mailing list. =A0Subscription management and archives:
ht= tps://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

--047d7b471da4c57d5104e2184abc--