caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Wojciech Meyer <wojciech.meyer@gmail.com>
To: oliver <oliver@first.in-berlin.de>
Cc: Christopher Zimmermann <madroach@gmerlin.de>,
	Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Re: functional or imperative feature ?
Date: Mon, 22 Jul 2013 12:51:08 +0100	[thread overview]
Message-ID: <CAOg1smA8Pc9a3X7Vh5jowkc4z_ino0GfENiCVg-dW0kUFmz8pQ@mail.gmail.com> (raw)
In-Reply-To: <20130722114230.GA2070@siouxsie>

[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]

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 <oliver@first.in-berlin.de> 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
>

[-- Attachment #2: Type: text/html, Size: 2257 bytes --]

  parent reply	other threads:[~2013-07-22 11:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-21 20:50 [Caml-list] " habet_ms
2013-07-21 20:57 ` [Caml-list] " Christopher Zimmermann
2013-07-22 11:42   ` oliver
2013-07-22 11:46     ` David Allsopp
2013-07-22 14:23       ` oliver
2013-07-22 11:51     ` Wojciech Meyer [this message]
2013-07-21 20:58 ` [Caml-list] " David Allsopp
2013-07-22 11:20 ` Jean-Marc Alliot
2013-07-22 12:05   ` r.3
2013-07-22 14:59 ` Kristopher Micinski
2013-07-23  0:16   ` oleg
2013-07-23  2:15     ` Kristopher Micinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOg1smA8Pc9a3X7Vh5jowkc4z_ino0GfENiCVg-dW0kUFmz8pQ@mail.gmail.com \
    --to=wojciech.meyer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=madroach@gmerlin.de \
    --cc=oliver@first.in-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).