From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id C2226BC2F for ; Thu, 25 Nov 2004 14:47:03 +0100 (CET) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iAPDl1KN003832 for ; Thu, 25 Nov 2004 14:47:02 +0100 Received: from [192.168.1.200] (ppp217-171.lns1.syd3.internode.on.net [203.122.217.171]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id iAPDkwOU079611; Fri, 26 Nov 2004 00:16:58 +1030 (CST) Subject: Re: [Caml-list] Experiences with learning OCaml? From: skaller Reply-To: skaller@users.sourceforge.net To: Erik de Castro Lopo Cc: caml-list@yquem.inria.fr In-Reply-To: <20041125225944.47a1d10a.ocaml-erikd@mega-nerd.com> References: <3033.66.167.163.102.1101382830.squirrel@acs-webmail.ucsd.edu> <20041125225944.47a1d10a.ocaml-erikd@mega-nerd.com> Content-Type: text/plain Organization: Message-Id: <1101390416.9291.37.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 26 Nov 2004 00:46:57 +1100 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 41A5E255.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 sourceforge:01 wrote:01 ocaml:01 integers:01 syntax:01 lexically:01 workarounds:01 mutable:01 way':01 glebe:01 sick:98 ...:98 061:98 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: On Thu, 2004-11-25 at 22:59, Erik de Castro Lopo wrote: > > Would doing this be difficult if one were sufficiently motivated? > > If you are reasonably familiar with languages as complex as C++ and > Java, then Ocaml is definitely not too difficult but will require > you to develope some new ways of thinking about programming problems. Functional programming is easy. There's a whole lot of fuss about something simple.. :) let decade = let k = 10 in map (fun i -> i * k) [1;2;3;4] I'm sure you'll understand the answer is the list of integers [10,20,30,40] once you grok the syntax, and that example contains a higher order function map (a function accepting a function as an argument) and a lexically scoped anonymous function (fun i -> i * k) which binds to the 'k' in scope. .. but these are just features 'you always wanted in C++ anyhow' and got sick of writing lame workarounds for ... :) Once you have these features, your style of programming will change naturally, even though Ocaml also has classes, object, mutable varables, and imperative constructions too. > Ocaml is a good choice. Yes, because you can have quite a bit of fun solving problems 'the usual imperative way' and then trying to make it simpler.. which you'll find functional programming helps with a lot. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net