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
0678899f
Commit
0678899f
authored
Nov 07, 2018
by
Michael Hanus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Example added
parent
f216267f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
examples/equivalent_operations/Intersperse.curry
examples/equivalent_operations/Intersperse.curry
+26
-0
examples/equivalent_operations/README.md
examples/equivalent_operations/README.md
+3
-1
examples/equivalent_operations/Take.curry
examples/equivalent_operations/Take.curry
+5
-1
No files found.
examples/equivalent_operations/Intersperse.curry
0 → 100644
View file @
0678899f
--- Example from:
---
--- Christiansen, J. and Seidel, D.: Minimally strict polymorphic functions
--- Proc. of the 13th International Symposium on Principle and Practice
--- of Declarative Programming (PPDP'11), pp. 53-64
--- DOI: 10.1145/2003476.2003487
import Test.Prop
--- Definition of `intersperse` from module `List`.
intersperse1 :: a -> [a] -> [a]
intersperse1 _ [] = []
intersperse1 _ [x] = [x]
intersperse1 sep (x:xs@(_:_)) = x : sep : intersperse1 sep xs
--- Less strict definition.
intersperse2 :: a -> [a] -> [a]
intersperse2 _ [] = []
intersperse2 sep (x:xs) = x : go xs
where
go [] = []
go (y:ys) = sep : y : go ys
-- These operations are not equivalent:
intersperseEquiv = intersperse1 <=> intersperse2
examples/equivalent_operations/README.md
View file @
0678899f
...
@@ -4,12 +4,14 @@ of CurryCheck to check the equivalence of operations.
...
@@ -4,12 +4,14 @@ of CurryCheck to check the equivalence of operations.
Since most of these are examples to test whether CurryCheck
Since most of these are examples to test whether CurryCheck
is able to report counter-examples, their test fails intentionally.
is able to report counter-examples, their test fails intentionally.
These are the programs
These are the programs
-
Intersperse (inserting separators in a list [Christiansen/Seidel'11])
-
Ints12 (generators for infinite lists)
-
Ints12 (generators for infinite lists)
-
NDInsert (non-deterministic list insertion)
-
NDInsert (non-deterministic list insertion)
-
RevRev (double reverse)
-
RevRev (double reverse)
-
SimpleExample
-
SimpleExample
-
SortEquiv (two variants of permutation sort)
-
SortEquiv (two variants of permutation sort)
-
Take (two variants of take)
-
Take (two variants of take [Foner/Zhang/Lampropoulos'18])
-
Unzip (two variants of unzip [Chitil'11])
The following programs contain successful equivalence tests:
The following programs contain successful equivalence tests:
-
Fac (recursive specification of factorial vs. iterative implementation)
-
Fac (recursive specification of factorial vs. iterative implementation)
...
...
examples/equivalent_operations/Take.curry
View file @
0678899f
--- Example to show the non-equivalence of two versions of the
--- Example to show the non-equivalence of two versions of the
--- `take` operation.
--- `take` operation, taken from
---
--- Foner, K. and Zhang, H. and Lampropoulos, L.: {Keep Your Laziness in Check
--- ICFP 2018,
--- DOI: 10.1145/3236797
import Test.Prop
import Test.Prop
...
...
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