From: sieira <jaimito.hendrix@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] Doubt about function delaration parameter
Date: Wed, 15 Dec 2010 06:03:10 -0800 (PST) [thread overview]
Message-ID: <30464033.post@talk.nabble.com> (raw)
Why doesn't this work?:
type menu = {Textos: string list; Claves:string list};;
let menu_principal = {Textos = ["Clientes";"Operaciones"];Claves =
["1";"2"]};;
let rec pinta_menu = function
{Textos = []; Claves = []} ->
begin
print_string ">";
();
end
| {Textos = _; Claves = []} ->
begin
print_string "[EE] Error en el menu";
();
end
| {Textos = []; Claves = _} ->
begin
print_string "[EE] Error en el menu";
();
end
| {Textos = texto::textos; Claves = clave::claves} ->
begin
print_string texto^"Una dola\n";
pinta_menu({Textos = textos; Claves = claves});
end;;
(Returns
"This expression has type unit"
)
While this does:
let rec pinta_menu = function
[],[] ->
begin
print_string ">";
();
end
| _,[] ->
begin
print_string "[EE] Error en el menu";
();
end
| [];_} ->
begin
print_string "[EE] Error en el menu";
();
end
| texto::textos;clave::claves ->
begin
print_string texto^"Una dola\n";
pinta_menu({Textos = textos; Claves = claves});
end;;
pinta_menu(menu_principal);;
Note that Textos ean texts and Claves mean keys
pinta_menu(menu_principal);;
--
View this message in context: http://old.nabble.com/Doubt-about-function-delaration-parameter-tp30464033p30464033.html
Sent from the Caml Discuss mailing list archive at Nabble.com.
next reply other threads:[~2010-12-15 14:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-15 14:03 sieira [this message]
2010-12-15 15:14 ` Ashish Agarwal
2010-12-15 15:18 ` Esther Baruk
2010-12-15 16:15 ` sieira
2010-12-15 16:37 ` David Allsopp
2010-12-15 16:56 ` Raphael Proust
2010-12-15 17:12 ` bluestorm
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=30464033.post@talk.nabble.com \
--to=jaimito.hendrix@gmail.com \
--cc=caml-list@inria.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