From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 1CF87BC57 for ; Wed, 15 Dec 2010 15:03:14 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhsBAGVZCE3Yi+wamWdsb2JhbACVeQEBjiwWAQEBAQEICwoHESSxeocvLohchUoEhGSGFw X-IronPort-AV: E=Sophos;i="4.59,349,1288566000"; d="scan'208";a="92437504" Received: from 216-139-236-26.aus.us.siteprotect.com (HELO sam.nabble.com) ([216.139.236.26]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 15 Dec 2010 15:03:13 +0100 Received: from isper.nabble.com ([192.168.236.156]) by sam.nabble.com with esmtp (Exim 4.69) (envelope-from ) id 1PSrwk-0001Au-Qx for caml-list@inria.fr; Wed, 15 Dec 2010 06:03:10 -0800 Message-ID: <30464033.post@talk.nabble.com> Date: Wed, 15 Dec 2010 06:03:10 -0800 (PST) From: sieira To: caml-list@inria.fr Subject: [Caml-list] Doubt about function delaration parameter MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: jaimito.hendrix@gmail.com X-Spam: no; 0.18; textos:98 claves:98 textos:98 clientes:98 claves:98 rec:01 rec:01 caml-list:01 expression:02 caml:02 parameter:02 string:02 string:02 una:96 una:96 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.