From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA15624; Fri, 25 Apr 2003 09:16:50 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA15683 for ; Fri, 25 Apr 2003 09:16:49 +0200 (MET DST) Received: from teutates.kfunigraz.ac.at (TEUTATES.kfunigraz.ac.at [143.50.129.26]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h3P7GmH13072 for ; Fri, 25 Apr 2003 09:16:48 +0200 (MET DST) Received: from localhost (localhost.localdomain [127.0.0.1]) by teutates.kfunigraz.ac.at (Postfix) with ESMTP id 6444E3D222C for ; Fri, 25 Apr 2003 09:16:47 +0200 (CEST) Received: from teutates.kfunigraz.ac.at ([127.0.0.1]) by localhost (teutates.kfunigraz.ac.at [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 30281-06 for ; Fri, 25 Apr 2003 09:16:46 +0200 (CEST) Received: from stud.uni-graz.at (IGAM08AV.kfunigraz.ac.at [143.50.39.35]) by teutates.kfunigraz.ac.at (Postfix) with ESMTP id 39CF13D222B for ; Fri, 25 Apr 2003 09:16:46 +0200 (CEST) Message-ID: <3EA8D012.8040700@stud.uni-graz.at> Date: Fri, 25 Apr 2003 08:05:06 +0200 From: Siegfried Gonzi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020204 X-Accept-Language: en-us MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] Easy solution in OCaml? Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at stud.uni-graz.at X-Spam: no; 0.00; siegfried:01 gonzi:01 stud:99 bigloo:01 matlab:01 dependencies:01 quarterly:99 irritating:01 python:01 compiler:01 ocaml:01 int:01 constructs:02 wrote:03 scheme:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi: First off: It is not homework. I am 29 and writing my PhD in physics. Often I am contemplating whether it would be possible to use OCaml in combination with my beloved Bigloo to perform statistical evaluations. I am not sure whether there are any out there who /can/ do this evaluations with OCaml what you normally would do with Matlab. The problem what arises: type system and working against the compiler. In Scheme changing a solution from lets say integer-array to double-array is easy, but in Clean for example you would have to change all your dependencies. I often skim over the libraries and came to the conclusion: C, C++, OCaml impossible for me to see any elegance; Clean a bit better; Bigloo/Scheme: I am not sure here, because everything looks the same maybe this is cheating, but I think it looks the most elegant and less intimitating from all. Rationale: given a list of 12 month. I would like to calculate the quarterly means and skip any nan. Easy? Yes it is but only on paper and in Scheme: e.g: [1,2,4,-1,45,56,45,56,8] nan=-1.0 result: [(1+2+3)/3, (45+56)/2, (45+56+8)/3] I wrote a program in Scheme in order to perform the aformentioned task. In Scheme I wrote it as functional as possible, but I fail to do this in Ocaml. I mean doing it in OCaml via loops would be straightforward, but I didn't succeed in coming up with a solution of: - relies on pattern matching? - is short and and shouldn't resemble imperative style Currently I do not have Clean installed, but I think I would have no problems to do the above requirement in Clean. I find the following irritating in OCaml: - why if-then constructs? I think this was called "guards" in Clean? Can I use block-structure instead? I hate blocks ala Python but never mind to use it in Clean's way. - why begin-end constructs? In Scheme begin-end constructs are ordinary, but I find it irritating to use it in OCaml. - is it possible to give type information for readbility. In Clean I often wroten upon entry of the function: sum:: Int Real -> Int sum a b = ... The above is not provocating. I learn best when I see how other would solve it in an /elegant functional way/. Regards, S. Gonzi ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners