Browse thread
[Caml-list] Doubt about function delaration parameter
-
sieira
- Ashish Agarwal
- Esther Baruk
- sieira
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Esther Baruk <esther.baruk@g...> |
| Subject: | Re: [Caml-list] Doubt about function delaration parameter |
When you write :
print_string texto^"Una dola\n";
you must put parenthesis around your string : print_string (texto^"Una
dola\n");
Otherwise it means you concatenates a string with a thing of type unit.
Esther
2010/12/15 sieira <jaimito.hendrix@gmail.com>
>
> 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
>