haskell: A pure functional language

[top]

  1. Pure functional language with lazy evaluation.
  2. Strongly typed with type inference.
  3. Example: Calculate prime numbers by sieve of Eratosthenes.

    -- Prime numbers written in Haskell
    -- Using infinite list and list comprehension
    
    primes = sieve [2..]
    sieve (x:xs) = x : sieve [ n | n <- xs, n `rem` x /= 0]
    

[top]