balanceTree.icl 886 Bytes
Newer Older
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
1
2
3
4
5
6
7
8
9
10
module balanceTree

import StdEnv
import StdHtml

import tree

derive gForm []
derive gUpd []

Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
11
Start world  = doHtmlServer MyPage3  world
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
12
13
//Start world  = doHtml MyPage  world

Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
14
15
16
myBalancedTree 	= nFormId "BalancedTree" 	(fromListToBalTree [0])
mySortedList	= nFormId "SortedList"  	[0]

Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
17
MyPage hst
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
18
# (balancedtree,hst) = mkSelfForm (initID myBalancedTree) balanceTree hst
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
19
20
21
22
23
24
=	mkHtml "Balanced Tree"
	[ H1 [] "Balanced Tree"
	, BodyTag balancedtree.form
	]  hst

MyPage2 hst
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
25
# (sortedlist,hst) = mkSelfForm (initID mySortedList) sort hst
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
26
27
28
29
30
31
32
=	mkHtml "Sorted List"
	[ H1 [] "Sorted List"
	, BodyTag sortedlist.form
	, toHtml (reverse sortedlist.value)
	]  hst

MyPage3 hst
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
33
# (treef,hst) = startCircuit mycircuit (Node Leaf 112 Leaf) hst
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
34
35
36
37
38
= mkHtml "Self Balancing Tree"
	[ H1 [] "Self Balancing Tree"
	, toBody treef
	] hst
where
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
39
	mycircuit = feedback (edit myBalancedTree) (arr  balanceTree)
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
40
	
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
41