Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
pp:2023:haskell:l08_2 [2023/04/27 13:56]
george.vanuta REMOVED ROOT APPROX
pp:2023:haskell:l08_2 [2023/04/27 14:16] (current)
george.vanuta
Line 124: Line 124:
 </​code>​ </​code>​
  
-**8.3.2.** In order to view an **infinite tree**, we need to convert it to a finite **binary tree**. Define the ''​sliceTree'',​ which takes a level ''​k'',​ an **infinite tree** and returns the first ''​k''​ levels of our tree, in the form of a finite one.+**8.3.2.** In order to view an **infinite tree**, we need to convert it to a finite **binary tree**. Define the function ​''​sliceTree'',​ which takes a level ''​k'',​ an **infinite tree** and returns the first ''​k''​ levels of our tree, in the form of a finite one.
  
 <code haskell> <code haskell>
Line 146: Line 146:
  
 **8.3.3.** Define the ''​generateTree''​ function, which takes a **root** ''​k'',​ a **left generator** function ''​leftF''​ and a **right generator** function ''​rightF''​.\\ **8.3.3.** Define the ''​generateTree''​ function, which takes a **root** ''​k'',​ a **left generator** function ''​leftF''​ and a **right generator** function ''​rightF''​.\\
-For example, let's say we have ''​k=2'',​ ''​leftF=(+1)'',​ ''​rightF=(*2)''​. This should generate a tree where the root is $math[2], the left child is $math[parent + 1]\\ +For example, let's say we have ''​k=2'',​ ''​leftF=(+1)'',​ ''​rightF=(*2)''​. This should generate a tree where the //root// is $math[2], the //left child// is $math[parent + 1]\\ 
-and the right child is $math[parent * 2].+and the //right child// is $math[parent * 2].
  
 <code haskell> <code haskell>