CIS 343 |
Kawa Scheme |
Winter 2023 |
c = 5/9(f - 32)
x1
, y1
, x2
, and y2
.
Try this one twice:
let
statement to avoid explicitly subtracting values twice.x2
.x
and y
.
Write two versions of this function:
cond
construct together with and
.if
(Have the outer if
check the x-coordinate, then have the inner, nested if
check the y-coordinate.)log2(val)
that returns the integer log base 2 of val
.
(Use the function truncate-quotient
to perform integer division.)count-up(from to)
that prints all the integers from from
to to
(inclusive).rectangle(width, height)
that prints a rectangle of asterisks with the given width and height.div-mod(divisor dividend)
that returns the quotient and remainder from dividing divisor
by dividend
. For example, (div-mod 17 5)
should
return (3, 2)
because 17 / 5 = 3
and 17 % 5 = 2
. Hint: You might want a helper function.item
in the list.item
into the list at position x
.item
into the list after the first occurrence of loc-val
.append
.map
function to convert a list of (firstName, lastName)
pairs instructor a list of strings formatted "lastName, firstName"
.
(One option is to use format
to build the string.)map
.select
that returns the list of items that meet the given criteria. Specifically, select
should take a lambda as a parameter. The output list should include all items for which the lambda returns true
.select
function to return all the positive numbers in a list.select
function to write a new function high-enough threshold lst
that returns all numbers in lst
that are greater than or equal to threshold
.
(To be clear: high-enough
should call threshold
.)
forEach from to action
that runs (action index)
for each value of
index
between from
and to
(inclusive).map
to take a list as input and constrain the values on the list to be between 0 and 100. (
If value is < 0, then set it to 0; If value is > 100, set it to 100)max
using fold
.fold
to compute the length of a list.Updated Monday, 3 April 2023, 9:46 AM