From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p0LAuSn3007780 for ; Fri, 21 Jan 2011 11:56:31 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAEv1OE2t/9A2/2dsb2JhbACEE6BRc64/kEaEXHQEjkQ X-IronPort-AV: E=Sophos;i="4.60,357,1291590000"; d="asc'?scan'208";a="87651161" Received: from sairyx.org ([173.255.208.54]) by mail2-smtp-roc.national.inria.fr with ESMTP; 21 Jan 2011 11:56:30 +0100 Received: by sairyx.org (Postfix, from userid 5001) id 18AFC48003; Fri, 21 Jan 2011 10:56:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sairyx.org X-Spam-Level: Received: from [192.168.0.104] (220-253-41-108.VIC.netspace.net.au [220.253.41.108]) (Authenticated sender: celtic@sairyx.org) by sairyx.org (Postfix) with ESMTPSA id DA2AA48001; Fri, 21 Jan 2011 10:56:27 +0000 (UTC) From: Arlen Cuss To: Francois Berenger Cc: caml-list@yquem.inria.fr In-Reply-To: <4D391C4A.9000608@riken.jp> References: <4D391C4A.9000608@riken.jp> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-4QcqVDPVYLwWfkEUJgiY" Date: Fri, 21 Jan 2011 21:56:19 +1100 Message-ID: <1295607379.2365.1.camel@asu> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Subject: Re: [Caml-list] writing some code using a function for which only the signature is known --=-4QcqVDPVYLwWfkEUJgiY Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2011-01-21 at 14:40 +0900, Francois Berenger wrote: > Hello, >=20 > If I am writing some code, and I don't want to dive > into implementing some sub function I will need but don't > have yet, what is the standard way to do this in ocaml? >=20 > In python, there is the pass keyword, Haskell has some > keyword which I don't remember for this also. >=20 > Sorry for the dumb question maybe, I am returning to ocaml > after a too long absence. :) >=20 > Regards, > Francois. >=20 I tend to use failwith (type is string -> 'a); it just raises Failure with your string, so.. # let my_fun par1 par2 par3 =3D failwith "myfun not implemented";; val my_fun : 'a -> 'b -> 'c -> 'd =3D # let sub_fun =3D function | true -> 42 | false -> my_fun 92 [1,2,3] 'x';; val sub_fun : bool -> int =3D # sub_fun true;; - : int =3D 42 # sub_fun false;; Exception: Failure "myfun not implemented". #=20 It type checks anything because it raises an exception. Arlen --=-4QcqVDPVYLwWfkEUJgiY Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAABAgAGBQJNOWZRAAoJEDiWqExGnQ/QiyEP/iptJvIIrhJomqW4P+kCidU8 WLYqPHwItmqtywS+vSkyWA8l/jlG8RRMAgQd/ejTZ/bL0Vvz4iqjVR2mu2Op3sZG 3ENzFCa8Vf8/3kfB5DOv5IEfXU6NwEHBJhMBgkExZsjN95wQj5sDzacYjatiGtbr XlO8zHMwKlTLzh/4AIiSc74exgfRVNFrhFdW5/vXk4EP0ROhOtQFoUZjwIQMwste 9LC5cUz2qEaSCmoqSp8zh6RPVrqwJHDIjEa/em9nTttiabAj9Y7rTWKljMrQgzS0 5oZqAGU3G+lem2AvUA8zY2j2E8TZZS5O2IUHWCS2zl5c4f8eh1skP/SaHcQBsZ3Z 6Uo9y9amXh26MUma9DiLdX/KRjF1wZ02iDMqidz5E662/Uet7C7hQuPERMvLkMEr VRL0oCBsc8Rj3fnX3hWy3oKpnNBGzf6dNRsDgDksTr09NOc7JPIoH7LaNEeQW7po Z4Wz3r1oa+ktFtkCemTTiaDPTSyisgR5Pj+UwgmLjmcbMODPhKZYUraYSG6wEAui N84UA1VpGhgMcU+/dxpl3PtLnnf0bZK+6yVjH7qm7ANzZQAL3B73Jd0JJhDYMgDS mM7ZGBjGoDWTejHkE8l+3NQZLI10HhFB5o34eDaHEsC3Bv6I+DyLJau+N9yVOIxf /lJKwCjDQJ3KpY9Md9jG =edOr -----END PGP SIGNATURE----- --=-4QcqVDPVYLwWfkEUJgiY--