From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 8E552BBAF for ; Wed, 3 Sep 2008 19:08:54 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuYBAJZhvkjAXQIniGdsb2JhbACSEz4BAQEPIJxphy4BAg X-IronPort-AV: E=Sophos;i="4.32,320,1217800800"; d="scan'208";a="16548213" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 03 Sep 2008 19:08:37 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m83H8b53008932 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 3 Sep 2008 19:08:37 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AogAAJZhvkhA6bjjmmdsb2JhbACSEz4BAQEBAQgFCAcRA5xmhy4BAg X-IronPort-AV: E=Sophos;i="4.32,320,1217800800"; d="scan'208";a="28777147" Received: from wr-out-0506.google.com ([64.233.184.227]) by mail4-smtp-sop.national.inria.fr with ESMTP; 03 Sep 2008 19:08:36 +0200 Received: by wr-out-0506.google.com with SMTP id 50so3347339wra.13 for ; Wed, 03 Sep 2008 10:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=84Jz/9+/BqqnnkB5+tBZubsGMbHPt26MbJ556cIXi7w=; b=CRJM17p+gs83Sxb7aSqq5f1ofpSTBtVeWXnKwlTk4VYk+LkSkwvU/4bU/uArnzh4zu 1eKuLgrjnuzvxsXNSz6h/zfz8wZavZxpJuyFbt73utjtMavWChjGmE1wVcrB+ZxWHs4i 4lANJTGTCIaZYeKzUamnecRAJB0q3u3JdN9sg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=flG9mBmH/dnC8gmS7kxfHKNloRj8j+IHFesiRn6zqsw3CXs/pS1mh8xO4t4xVZ9DgI nL7btZNk7abtOnUZqAb18+ihurKo4MW7d+ShQg5s8xjn7F52BRm8BcWjUyBQEGzj1sif d+O7spk53hqezVrKTLQw1pWjKqnHzNjGV9M5o= Received: by 10.90.71.15 with SMTP id t15mr2269947aga.108.1220461713585; Wed, 03 Sep 2008 10:08:33 -0700 (PDT) Received: by 10.90.63.19 with HTTP; Wed, 3 Sep 2008 10:08:33 -0700 (PDT) Message-ID: Date: Wed, 3 Sep 2008 19:08:33 +0200 From: "circ ular" To: caml-list@inria.fr Subject: is there a switch or cond-statement? nested functions? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Miltered: at concorde with ID 48BEC495.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0200,:01 wrote:01 rec:01 rewrite:01 compiles:01 caml-list:01 functions:01 functions:01 cond:02 cond:02 expression:02 argument:02 float:03 float:03 parameters:03 thanks, the type problem is solved. but is there a way to write nested functions? so the powerf isn't exposed outwards... and how can I rewrite the if statements in a case or cond way? pattern mathcing is only on types right? cond a la scheme would be nice. let rec powerf(n, pow, acc) = if pow > 0.0 then powerf(n, pow -. 1., acc *. n) else if pow < 0.0 then 1. /. powerf(n, pow *. (-1.), acc) else acc ;; let power(n, pow) = powerf(n, pow, 1.);; ---------- Forwarded message ---------- From: Date: Wed, Sep 3, 2008 at 7:27 AM Subject: Re: [Caml-list] is there a switch or cond-statement? + type-problem To: circ ular On Wed, Sep 03, 2008 at 06:55:22AM +0200, circ ular wrote: > thanks, not it compiles but I get this error instead: > # powerx(5.0,2.0);; > Characters 6-15: > powerx(5.0,2.0);; > ^^^^^^^^^ > This expression has type float * float but is here used with type > float * float * float > # The error message tells you: You called powerx with two float parameters, but you need three float parameters. When loooking at the definition you see that you forgot to give the argument for the accumulator. Try calling i as powerx(5., 2., 1.) instead :) With kind regards, -Martin