From: Marcin 'Qrczak' Kowalczyk Date: 2002-08-26T19:40:37+09:00 Subject: Re: A Repeat: New Language After Ruby? Sat, 24 Aug 2002 00:58:45 +0900, William Djaja Tjokroaminata pisze: > Is it really true that Ruby is in many ways a functional language? In one way it is: it makes great use of anonymous functions with lexical scope (i.e. blocks and procs), including basic library functions for iterating over lists. Unpacking multiple results into named variables is also the way functional languages usually return several results. In another way it isn't: modifying values and binding new values to variables is common, and even strings are mutable. It also doesn't provide common functional features: pattern matching together with extracting values from components of matched structured values; lists in the style of Lisp/Scheme/ML/Haskell/etc. - a list is either empty or consists of the first element (head) and the rest which is a list (tail), where accessing tail and building a new list from given head & tail is O(1); or algebraic types in general. > I am almost at the point of deciding to learn a functional language. > The only problem is still the question, why Haskell? Why not Scheme, > ML, or Lisp, which have discussion groups? I'm subscribed to 13 Haskell-specific mailing lists (including related to particular compilers). Haskell is more pure compared to these other languages: side effects like I/O are in a separate layer in the language semantics, and mutable variables are rare (not in the standard even). Haskell's type system is more advanced than ML's (and also more complex), it has a very interesting system of overloading/dispatching. OTOH OCaml is more practical: very fast implementation. Haskell strings are lists of characters, so you construct and deconstruct them with recursive functions, your own or generic list functions, and it's convenient but slow; OCaml strings are array-like and mutable, you must preallocate and fill them (inconvenient and bad style but fast) or glue from smaller strings (more convenient but slower) or use an extensible string buffer (not functional style). -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/