Lazy and Strict Functional languages 
Author Message
 Lazy and Strict Functional languages

Hi,

I wanted to know what exactly do we mean by Lazy Functional Language and
Strict Functional Language and what are the differences?

Thanks in advance,

Nikhil

PS: I prefer to recieve a mail rather than read in news groups. Thanks you for
    your understanding.



Tue, 20 Jul 2004 23:28:53 GMT  
 Lazy and Strict Functional languages

Quote:

> Hi,

> I wanted to know what exactly do we mean by Lazy Functional Language and
> Strict Functional Language and what are the differences?

In a strict functional language the arguments to a function are
completely evaluated before the function is applied. In a lazy language,
the arguments are evaluated as needed.

As an example, consider the following function definition:

ones = 1 : ones

(producing an infinite list of '1's)

In a strict language this would be unusable (as it would be a
non-terminating calculation. In a lazy language, however, such a
definition could be useful. Consider the following additional function
definition:

take 0 _ = []
take n (x:xs) = x : take (n-1) xs

which returns the first n elements of a list (note that this definition
would work with either evaluation strategy).

In a lazy language, the expression:

take 5 ones

would yield [1,1,1,1,1], as at each invocation only the first element of
the list argument would need to be completely eveluated.

This is clearly just an informal description, but should provide at
least some clarification.

HTH,
--ag

--
Artie Gold  --  Austin, TX

"May you keep turning the pages. And may the book never end."



Wed, 21 Jul 2004 09:01:03 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Speed of FP languages, prospects (was Re: Benchmarking Lazy Functional Languages)

2. books/papers on implementing strict functional languages

3. Fast compilation of strict functional languages

4. multiplatform GUI design with parallelized lazy functional language

5. Benchmarking Lazy Functional Languages

6. Partial Evaluation for Lazy Functional Languages

7. Monitoring (Lazy) Functional Languages

8. Profiling Lazy Functional Languages

9. Time complexity of lazy programs. profiling functional languages

10. Lazy-evaluation functional language for MS DOS

11. Applications for lazy functional languages

12. Functional Programming Languages with Lazy Evaluation

 

 
Powered by phpBB® Forum Software