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=1.6 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 4DF1FBBAF for ; Tue, 5 Aug 2008 15:26:30 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkoBAEDyl0jRVZKxjmdsb2JhbACQfD4BAQEBCQMKBw8FlwCFbQ X-IronPort-AV: E=Sophos;i="4.31,310,1215381600"; d="scan'208";a="13733647" Received: from wa-out-1112.google.com ([209.85.146.177]) by mail2-smtp-roc.national.inria.fr with ESMTP; 05 Aug 2008 15:26:29 +0200 Received: by wa-out-1112.google.com with SMTP id j4so1619231wah.3 for ; Tue, 05 Aug 2008 06:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:reply-to:to:subject:date :user-agent:cc:references:in-reply-to:content-type :content-transfer-encoding:content-disposition:message-id; bh=4oVynK99ylFSDI0ehRgVrF6pYiFuXzXxjWOneJdtM5k=; b=DfVa5caqsSVm8VFutqFnZuOheocATqbttu/JAq40CQr4gNOznN99zMTgTLF2K1kbdA APkeQlmemDp502C1LBb3uqjVnDNdJfMah0/x//ZztFcTgbj1GDPr8ensLQd8wfyTk6op 5ZwcKN3HyTTNqpdOAVeCKvIpS7MTKrPLcngVI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:cc:references:in-reply-to :content-type:content-transfer-encoding:content-disposition :message-id; b=RzDAk3vwjzrfBYPS514IUfr3T+k/T16zVxkOhJ/HGxdI/GaciQjGcxCUdOdFZPb57d ciQDmpnLrx/rL5PPI3MnpE7O7sZyRYQXk5vb+6W6V3qW6qsAU9PCw0HvEncrvO/BYJoT BrStdvUwH4eFKITfSQIM/7IRul7euwxYWPBpo= Received: by 10.114.124.12 with SMTP id w12mr15445650wac.210.1217942787693; Tue, 05 Aug 2008 06:26:27 -0700 (PDT) Received: from lawn-143-215-204-204.lawn.gatech.edu ( [143.215.204.204]) by mx.google.com with ESMTPS id 4sm1757738yxq.8.2008.08.05.06.26.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 05 Aug 2008 06:26:27 -0700 (PDT) From: Peng Zang Reply-To: peng.zang@gmail.com To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] newbie: how to call a function with multiple parameters? Date: Tue, 5 Aug 2008 09:26:22 -0400 User-Agent: KMail/1.9.7 Cc: "Ben Aurel" References: <74a4f4670808041132p757cb91aofd8d0d826dd081b4@mail.gmail.com> In-Reply-To: <74a4f4670808041132p757cb91aofd8d0d826dd081b4@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808050926.25737.peng.zang@gmail.com> X-Spam: no; 0.00; hash:01 ocaml:01 ocaml:01 printf:01 printf:01 semicolon:01 beginner's:01 bug:01 peng:98 peng:98 beginners:01 wrote:01 compile:01 caml-list:01 caml-list:01 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 You don't pass arguments like you do in C or Java. In those languages you might do: somefunction(arg1, arg2, arg3) In OCaml, you do: somefunction arg1 arg2 arg3 In OCaml, "(arg1, arg2, arg3)" means create a 3-tuple. "somefunction(arg1, arg2, arg3)" is interpreted as make a 3-tuple and call "somefunction" on that tuple. You code, therefore, should look like this: let print_logic a b = Printf.printf "a and b is %B\n" (a && b); Printf.printf "a or b is %B\n" (a || b); Printf.printf "not a is %B\n" (not a) ;; print_logic true false;; Peng On Monday 04 August 2008 02:32:36 pm Ben Aurel wrote: > hi > yeah - the question is low, but I-m struggling on different frontiers > > /////////////// print_logic.ml /////////////////////////////// > ```````````````````````````````````````` > 1 let print_logic a b = > 2 Printf.printf "a and b is %B\n" (a && b); > 3 Printf.printf "a or b is %B\n" (a || b); > 4 Printf.printf "not a is %B\n" (not a) (* Q1 *) > 5 > 6 print_logic(true, false);; (* Q2 *) > > ``````````````````````````````````````` > > Problem: the code doesn't compile and I don't find any help on the web. > > Questions: > (* Q1 *): Somehow I don't get the concept with ";" and ";;". On line > 4 do I need to end the statement with semicolon double-semicolon or > nothing? > > (* Q2 *): How can I pass those parameters? > > > Maybe there is something that's else wrong. > > thanks > ben > > _______________________________________________ > 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFImFUBfIRcEFL/JewRAuRvAJ4yXnpbBE6wQzBlg66hClZomYWBPACfUabY rHz86mdOg5FIaSk/bi5O9aE= =L61/ -----END PGP SIGNATURE-----