News for hackers. Stuff that matters.
Re:... because Ruby isn't terse enough yet by dfranke on Saturday October 27, 2007 @02:54PM (#73227)
I think Haskell is overall terser than Ruby. The trouble with the accgen test is that it's imperative, and Haskell isn't meant to be. Here's the Haskell implementation that I would submit:

  putStrLn "Don't do that, you nimwit!"
Re:... because Ruby isn't terse enough yet by yariv on Saturday October 27, 2007 @03:07PM (#73230)
The Erlang version is unnecessarily verbose (and also semantically different) because it uses 2 processes. It can be rewritten as

Foo = fun(N) -> put(var, N), fun(X) -> V = get(var) + X, put(var, V), V end end.

It's not as concise as Ruby or Arc, but it's a one liner. However, similar to Haskell, this style of programming is discouraged in Erlang.

Re:... because Ruby isn't terse enough yet by rkts on Saturday October 27, 2007 @07:52PM (#73292)
In ML you can get a similar terseness to that of Haskell, but with support for imperative programming. If we allow the increment function to be predefined (as the Arc example does):

 let inc a b = a := !a +/ b; !a
then foo becomes:

 let foo n = inc (ref n)
or, with the help of the composition operator:

 let (<<) f g x = f (g x)

 let foo = inc << ref