This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
cs330_f2016:rackethof2 [2018/01/23 16:06] morse [Notes:] |
cs330_f2016:rackethof2 [2021/06/30 23:42] (current) |
||
---|---|---|---|
Line 16: | Line 16: | ||
* ''default-parms'' - decorates a function to add default parameter values | * ''default-parms'' - decorates a function to add default parameter values | ||
* ''type-parms'' - decorates a function to enforce parameter type checking | * ''type-parms'' - decorates a function to enforce parameter type checking | ||
+ | * ''new-sin2'' - a decorated version of your earlier ''new-sin'' that fills in default parameters and enforces correct types for all parameters | ||
You will also chain these together to add both parameter type checking and default parameters to a function. | You will also chain these together to add both parameter type checking and default parameters to a function. | ||
Line 65: | Line 66: | ||
* uses ''0'' and '''radians'' as defaults for the parameters, and | * uses ''0'' and '''radians'' as defaults for the parameters, and | ||
* verifies that the first parameter is a number and that the second parameter is a symbol. | * verifies that the first parameter is a number and that the second parameter is a symbol. | ||
+ | This must be created using ''default-parms'' and ''type-parms'', not hand-coded. | ||
---- | ---- | ||
Line 73: | Line 75: | ||
Your code only needs to return correct values given correct inputs. | Your code only needs to return correct values given correct inputs. | ||
- | Note: catching incorrectly typed inputs is part of the specified functionality for the type-parms decorator, so the functions generated by it should specifically detect and report that type of error. | + | Note: catching incorrectly typed inputs is part of the specified functionality for the ''type-parms'' decorator, so the functions generated by it should specifically detect and report that type of error. |
---- | ---- |