Linked by Thom Holwerda on Thu 6th Sep 2012 18:07 UTC, submitted by MOS6510
General Development "Imagine an approach to programming where you write down some description of what your code should do, then before running your code you run some automatic tool to see if the code matches the description. That's Test-driven development, you say! Actually, this is what you are doing when you use static types in most languages too. Types are a description of the code's inputs and outputs, and the check ensures that inputs and outputs match up and are used consistently. Modern type systems - such as in Haskell or above - are very flexible, and allow these descriptions to be quite detailed; plus they are not too obtrusive in use and often very helpful."
Thread beginning with comment 534329
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[3]: It's interesting...
by Alfman on Sat 8th Sep 2012 04:43 UTC in reply to "RE[2]: It's interesting..."
Member since:

My memory must be failing me because I thought haskell supported lazy evaluation and solving problems using automatic variable enumeration with constraints. Quite the contrary haskell requires all variables to hold exact values from their instantiation. Therefore it seems you are right that haskell is another functional language. Prolog is the language that requires a completely different way of thinking about algorithms, but I forget what other language it was similar to... oh well that's what happens when there are too many languages to keep track of - they all blur together.

Reply Parent Score: 2

RE[4]: It's interesting...
by satsujinka on Sat 8th Sep 2012 05:32 in reply to "RE[3]: It's interesting..."
satsujinka Member since:

Haskell is lazily evaluated.

Reply Parent Score: 2

RE[5]: It's interesting...
by Alfman on Sat 8th Sep 2012 06:25 in reply to "RE[4]: It's interesting..."
Alfman Member since:

I was really referring to the lazy evaluation as it applies more specifically to prolog. In typical languages (and haskell) a variable can only hold one value (the value may be a list, but it's never the less discrete). In prolog a variable can hold all possible values at the same time and you need to add criteria to get to the values that you want. If you evaluate prolog variables at some intermediate points, it might produce an infinite number of possible values. However due to lazy evaluation, the language is able to do algebraic manipulation against sequence generators INSTEAD of attempting to test each possible discrete value. In other languages where a variable cannot represent more than one value, this doesn't really come up (whether the value is computed from a lazily evaluated function or not).

It's really been a long time since I've worked with prolog, I'd have to go research it some more. It really is a fundamental change in the way we think of algorithms.

Reply Parent Score: 2