This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
cs330_f2016:rackethof [2016/09/09 15:42] morse |
cs330_f2016:rackethof [2021/06/30 23:42] (current) |
||
---|---|---|---|
Line 4: | Line 4: | ||
* First-class functions | * First-class functions | ||
* Anonymous functions | * Anonymous functions | ||
- | * Map | + | * Map (including andmap and ormap) |
* Filter | * Filter | ||
* Fold | * Fold | ||
Line 18: | Line 18: | ||
====Deliverables:==== | ====Deliverables:==== | ||
- | For this lab, you will need to reimplement the following functions from the previous lab using Racket's higher-order functions ''map'', ''filter'', or ''foldr'': | + | For this lab, you will need to reimplement the following functions from the previous lab using Racket's higher-order functions ''map'' (including ''andmap'' and ''ormap''), ''filter'', or ''foldr''. You may not use functions that take or return indices, such as ''index-of'' or ''list-ref'': |
* ''convertFC'' | * ''convertFC'' | ||
* ''check-temps1'' | * ''check-temps1'' | ||
Line 26: | Line 26: | ||
* ''average'' | * ''average'' | ||
* ''eliminate-larger'' | * ''eliminate-larger'' | ||
+ | |||
+ | You must write these using higher-order functions rather than implementing the recursion yourself. | ||
+ | As with the previous lab, you may not use ''set!''. | ||
In addition, you will need to implement the following function: | In addition, you will need to implement the following function: | ||
Line 35: | Line 38: | ||
</code> | </code> | ||
where ''func'' is a two-parameter function and the result is a curried version of that two-parameter function. | where ''func'' is a two-parameter function and the result is a curried version of that two-parameter function. | ||
+ | |||
+ | You may not use any built-in curry functions to implement this. | ||
+ | |||
+ | Hint: You **don't** need to know what the function passed in actually does. All you need to know is that it requires two parameters, and once you have those parameters you use the function. | ||
---- | ---- |