[Haskell-cafe] I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language.

Curt Sampson cjs at starling-software.com
Thu Oct 1 07:37:28 EDT 2009


On 2009-10-01 08:53 +0100 (Thu), Andrew Coppin wrote:

> Sure. But what is a computer program? It's a *list of instructions* that  
> tells a computer *how to do something*.

Some are. Some aren't, as proven by the Haskell definition of sum, which
is certainly a "program."

I like to think of a program as a specification. A list of instructions
can certainly qualify, but so can other things, depending on what's
interpreting and executing that specification.

On 2009-10-01 08:59 +0100 (Thu), Andrew Coppin wrote:

> Although, to all the people who ask "why is Ruby so popular?", I might  
> suggest "because it's easy to learn"...

Actually, Ruby isn't terribly easy to learn. If you have previous
experience in another imperative or OO language, you'll pick up the
parts of Ruby that are similar to that fairly quickly, but you're not
really learning anything so much as just doing a simple translation of a
few concepts you already know. You're still going to run into problems
with a number of standard Ruby constructions, probably not be writing
clean or idiomatic code, and you'll be a long way from writing DSLs. In
particular, you're likely to be writing highly repetitive code which
could easily be refactored into something much smaller and nicer. (I'm
constantly seeing people who have programmed in Ruby for years come up
with six- to ten-line chunks of code that are could be replaced with a
single line if they, e.g., only know that there was such as thing as a
"modulo" function.)

>From reading a lot of the code out there (particularly disasters such
as Rails), I suspect a lot of Ruby programmers don't get much past
this level.

cjs
-- 
Curt Sampson       <cjs at starling-software.com>        +81 90 7737 2974
           Functional programming in all senses of the word:
                   http://www.starling-software.com


More information about the Haskell-Cafe mailing list