From: Clement Renard <Clement.Renard@inria.fr>
To: "José Romildo Malaquias" <romildo@uber.com.br>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Function definition with multiple patterns in multiple equations
Date: Tue, 8 Jan 2002 14:18:29 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.21.0201081417160.9532-100000@rotie.inria.fr> (raw)
In-Reply-To: <20020108110836.A9147@darling.home.br>
On Tue, 8 Jan 2002, José Romildo Malaquias wrote:
> Hello.
>
> I am trying to define a function in OCaml with multiple equations (rules)
> and multiple patterns in each equation. I have tried the 3 forms below,
> without success.
>
> let f 0 0 = 1
> | f _ _ = 0
>
> let f = fun 0 0 -> 1
> | _ _ -> 0
>
> let f = function 0 0 -> 1
> | _ _ -> 0
>
> None of them seems to be supported by the language. In SML, one can write
>
> fun f 0 0 = 1
> | f _ _ = 0
>
> What is the equivalent in OCaml?
For example :
let f x y = match x,y with
0,0 -> 1
|_,_ -> 0
Clement Renard
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2002-01-08 13:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <romildo@uber.com.br>
2002-01-08 13:08 ` José Romildo Malaquias
2002-01-08 13:16 ` Francois Thomasset
2002-01-08 13:18 ` Clement Renard [this message]
2002-01-08 13:26 ` John Prevost
2002-01-11 9:23 ` Xavier Leroy
2002-01-11 9:47 ` Andreas Rossberg
2002-01-08 13:30 ` Remi VANICAT
2002-01-09 13:28 ` [Caml-list] teil recursive function and GC Christophe Raffalli
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=Pine.LNX.4.21.0201081417160.9532-100000@rotie.inria.fr \
--to=clement.renard@inria.fr \
--cc=caml-list@inria.fr \
--cc=romildo@uber.com.br \
/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