Commit f216267f authored by Michael Hanus 's avatar Michael Hanus

Example added

parent 01dbf5bf
--- Example from:
---
--- Olaf Chitil:
--- StrictCheck: a Tool for Testing Whether a Function is Unnecessarily Strict
--- University of Kent, TR 2-11, 2011
--- https://kar.kent.ac.uk/30756/
import Test.Prop
--- Definition of unzip from the standard prelude.
unzip1 :: [(a,b)] -> ([a],[b])
unzip1 [] = ([],[])
unzip1 ((x,y):ps) = (x:xs,y:ys) where (xs,ys) = unzip1 ps
--- Definition from Chitil'11:
unzip2 :: [(a,b)] -> ([a],[b])
unzip2 xs = foldr (\(a,b) (as,bs) -> (a:as,b:bs)) ([],[]) xs
-- These operations are not equivalent:
unzipEquiv = unzip1 <=> unzip2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment