Record field names must start with a lower case letter, so I cannot
reproduce the error you mention.

Also note you can simplify code like:

    print_string "foo"; ();

to simply

    print_string "foo"

Since print_string "foo" already returns unit, it is unnecessary to
explicitly return unit after this.


On Wed, Dec 15, 2010 at 9:03 AM, sieira <jaimito.hend...@gmail.com> wrote:

>
> 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
>
_______________________________________________
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

Reply via email to