File: treemirror.curry

package info (click to toggle)
curry-tools 1.0.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,492 kB
  • ctags: 121
  • sloc: makefile: 470; sh: 421
file content (10 lines) | stat: -rw-r--r-- 230 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10

data Tree a = Leaf a | Branch (Tree a) (Tree a)

leaf   x   = Leaf x
branch a b = Branch a b

mirror l@(leaf   x) = l
mirror (branch a b) = branch (mirror b) (mirror a)

main = mirror (branch (leaf 1) (branch (leaf 2) (leaf 3)))