When you write :
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.
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs