mirror of
https://github.com/anoma/juvix.git
synced 2024-12-04 17:07:28 +03:00
18 lines
352 B
Plaintext
18 lines
352 B
Plaintext
module TreeGen;
|
|
|
|
import Stdlib.Prelude open;
|
|
|
|
type Tree :=
|
|
| leaf : Tree
|
|
| node : Tree → Tree → Tree;
|
|
|
|
gen : Nat → Tree
|
|
| zero := leaf
|
|
| (suc zero) := node leaf leaf
|
|
| (suc (suc n')) := node (gen n') (gen (suc n'));
|
|
|
|
gen2 : Nat → Tree
|
|
| zero := leaf
|
|
| (suc zero) := node leaf leaf
|
|
| (suc n@(suc n')) := node (gen2 n') (gen2 n);
|