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:l04x [2021/04/05 11:20]
dmihai
pp:l04x [2021/04/05 14:51] (current)
alexandru.poboranu add a Context in the last 2 ex
Line 44: Line 44:
  
 <code haskell> <code haskell>
-pointToPair :: Point Float Float -> (Float, Float)+pointToPair :: Point -> (Float, Float)
 pointToPair (Point x y) = (x, y) pointToPair (Point x y) = (x, y)
 </​code>​ </​code>​
Line 153: Line 153:
 21. Write a function ''​search''​ which takes a ''​Context''​ and a variable name and returns the value from that context (it is guaranteed, that exactly one value exists for each variable on which the function is called; you don't need to account for any edge-case). 21. Write a function ''​search''​ which takes a ''​Context''​ and a variable name and returns the value from that context (it is guaranteed, that exactly one value exists for each variable on which the function is called; you don't need to account for any edge-case).
  
-22. Write a function ''​evalA''​ which takes an ''​AExpr''​ and returns a single integer representing its evaluated value.+22. Write a function ''​evalA''​ which takes a ''​Context''​ and an ''​AExpr''​ and returns a single integer representing its evaluated value.
  
-23. Write a function ''​evalB''​ which takes a ''​BExpr''​ and returns a single boolean representing its evaluated value.+23. Write a function ''​evalB''​ which takes a ''​Context''​ and a ''​BExpr''​ and returns a single boolean representing its evaluated value.