From d556e5508fe89ce51708b6914ae78a00aaa01ad8 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Fri, 29 May 2015 14:47:41 +0200 Subject: t --- fp2/week6/mart/BinSearchTreeImage.icl | 57 ----------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 fp2/week6/mart/BinSearchTreeImage.icl (limited to 'fp2/week6/mart/BinSearchTreeImage.icl') diff --git a/fp2/week6/mart/BinSearchTreeImage.icl b/fp2/week6/mart/BinSearchTreeImage.icl deleted file mode 100644 index 1662608..0000000 --- a/fp2/week6/mart/BinSearchTreeImage.icl +++ /dev/null @@ -1,57 +0,0 @@ -module BinSearchTreeImage - -/* Instructions: - -(1) copy BinTree.(i/d)cl and BinSearchTree.(i/d)cl from Practicum to - {iTasks-SDK}\Experiments\SVG_tests\ - -(2) in these modules change the type - - :: Tree a = Node a (Tree a) (Tree a) | Leaf - - to - - :: BTree a = BLeaf | BNode a (BTree a) (BTree a) // ORDER OF DATACONSTRUCTORS IS ESSENTIAL!! - - and adapt the corresponding function definitions. - -(3) this main file (BinSearchTreeImage.icl) must be in the same folder: - {iTasks-SDK}\Experiments\SVG_tests\ - -(4) create a new project and set de environment to 'iTasks' - -(5) Bring-Up-To-Date and start generated application - -(6) Open a browser and navigate to localhost. - The application creates two tasks: - (a) The task on the left allows you to enter subsequent elements that are inserted in the tree, one after another. - (b) The task on the right must be finished by you by writing the function treeImage. This function must render the tree structure in such a way - that Nodes of the same depth have the same y-coordinate, and the root having the smallest y-coordinate. -*/ - -import iTasks // de algemene iTask API -import iTasks.API.Extensions.SVG.SVGlet // specialiseer task editors -from StdFunc import flip - -import BinSearchTree // type definition of Tree and sample trees z0 .. z8 -derive class iTask BTree - -Start :: *World -> *World -Start world = startEngine [publish "/" (WebApp []) (\_ -> task)] world - -task :: Task [Int] -task = withShared [] (\sharedList -> - ( (updateSharedInformation (Title "Edit list") [] sharedList <<@ ArrangeHorizontal) - -||- - (viewSharedInformation (Title "Tree view") [imageView treeImage` (\_ _ -> Nothing)] sharedList <<@ ArrangeHorizontal) - ) <<@ ArrangeHorizontal - ) <<@ FullScreen - -font = normalFontDef "Courier New" fonthoogte -fonthoogte = 14.0 - -treeImage` :: [Int] *TagSource -> Image m -treeImage` nrs tags = treeImage (foldl (flip insertTree) BLeaf nrs) tags - -treeImage :: (BTree Int) *TagSource -> Image m -treeImage tree ts = text (normalFontDef "Courier New" 12.0) "I need to draw a tree!" -- cgit v1.2.3