Proposed task list for days-in-range
For the days-in-range
function, here’s a possible task list, with annotations (after ==>) on how to implement each task:
-
determine whether a temperature is with a range of two other numbers
==> write a lam
or a named function for this
-
determine whether all temps in a list are within a range
==> write a helper such as
all-in-range(lst :: List<Number>, low :: Number, high :: Number) -> Boolean
-
find the days for which all temps are within a range
==> filter the data using all-in-range
-
count the days from the previous step
==> Use L.length
You could also choose to combine tasks 3 and 4 into something like the following:
-
count the days for which all temps are within a range
==> recur through the days-lists, counting those for which all-in-range
returns true
Proposed task list for days-in-range
For the
days-in-range
function, here’s a possible task list, with annotations (after ==>) on how to implement each task:determine whether a temperature is with a range of two other numbers
==> write a
lam
or a named function for thisdetermine whether all temps in a list are within a range
==> write a helper such as
all-in-range(lst :: List<Number>, low :: Number, high :: Number) -> Boolean
find the days for which all temps are within a range
==> filter the data using
all-in-range
count the days from the previous step
==> Use
L.length
You could also choose to combine tasks 3 and 4 into something like the following:
count the days for which all temps are within a range
==> recur through the days-lists, counting those for which
all-in-range
returns true