From: David Allsopp <dra-news@metastack.com>
To: "habet_ms@yahoo.fr" <habet_ms@yahoo.fr>,
"caml-list@inria.fr" <caml-list@inria.fr>
Subject: RE: [Caml-list] functional or imperative feature ?
Date: Sun, 21 Jul 2013 20:58:01 +0000 [thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9CCA6F4E9@Remus.metastack.local> (raw)
In-Reply-To: <sympa.1374439723.23701.176@inria.fr>
habet_ms@yahoo.fr wrote:
> Hi,
> are sequencing (;) and block structure (begin ... end) functional
> features
> or imperative ones ?
Any sequence
e1; e2; e3;;
can be rewritten
let _ = e1 in
let _ = e2 in
e3;;
(with the difference that in a sequence, the compiler warns you if e1 and e2 don't have type unit)
It's not strictly speaking an imperative construct but it's only really of use in imperative programming.
Conversely begin ... end is neither explicitly functional nor imperative - it's simply a form of brackets. Consider nested matches (definitely functional):
let f x y =
match x with
`Foo ->
begin
match y with
`Bar -> true
| _ -> failwith "Bar"
end
| _ ->
failwith "Foo"
HTH,
David
next prev parent reply other threads:[~2013-07-21 20:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-21 20:50 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
2013-07-21 20:58 ` David Allsopp [this message]
2013-07-22 11:20 ` [Caml-list] " 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=E51C5B015DBD1348A1D85763337FB6D9CCA6F4E9@Remus.metastack.local \
--to=dra-news@metastack.com \
--cc=caml-list@inria.fr \
--cc=habet_ms@yahoo.fr \
/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