Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
curry-packages
currycheck
Commits
f216267f
Commit
f216267f
authored
Nov 06, 2018
by
Michael Hanus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Example added
parent
01dbf5bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
examples/equivalent_operations/Unzip.curry
examples/equivalent_operations/Unzip.curry
+20
-0
No files found.
examples/equivalent_operations/Unzip.curry
0 → 100644
View file @
f216267f
--- 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment