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
fp:lab09 [2021/05/13 16:03]
pdmatei
fp:lab09 [2021/05/13 17:39] (current)
pdmatei
Line 51: Line 51:
       - gender (''​male''​ or ''​female''​)       - gender (''​male''​ or ''​female''​)
  
- * Implement the type ''​Gender''​ (it is better to define a gender separately, instead of using True/False or strings, because it reduces the occurrence of bugs). +  ​* Implement the type ''​Gender''​ (it is better to define a gender separately, instead of using True/False or strings, because it reduces the occurrence of bugs). 
- * Implement a function which takes a gender, a list of ID's and returns those having that gender (you can safely assume that the CNP has valid form. **Hint:** use functional closures and higher-order functions).+  * Implement a function which takes a gender, a list of ID's and returns those having that gender (you can safely assume that the CNP has valid form. **Hint:** use functional closures and higher-order functions).
  
 <code haskell> <code haskell>
Line 64: Line 64:
 </​code>​ </​code>​
  
-9.1.5. ​(**Optional**) ​Define an ADTs called ''​Range'',​ which encodes a **range** of birth years together with a gender. For instance:+9.1.5. Define an ADTs called ''​Range'',​ which encodes a **range** of birth years together with a gender. For instance:
   - one range could designate people of gender //female// born between 1956 and 2005   - one range could designate people of gender //female// born between 1956 and 2005
   - another range could designate both //male// and //female// born between 1991 and 2006   - another range could designate both //male// and //female// born between 1991 and 2006