ant difference: variables can represent more than numbers. For example, Scheme variables can represent tex... ce these additional types of data, in addition to numbers. We will write programs that permit us to play with numbers, text, images, and even produce some animations-...
===== Today's Lecture and Lab =====
==== Numbers and Functions ====
We will be writing programs
s that computes all the permutations of a list of numbers
* Be sure to write tests for each function as ... == Background ====
The permutations of a list of numbers is the list of all possible sequences of those numbers. We will represent the permutations of a list of numbers as a list of lists of numbers. When your program
, ''my-sum'').
<code>
fun my-product(lst :: List<Number>) -> Number:
doc: ```returns the product of the numbers in list lst```
cases (List) lst:
| empty => 1
| l... parts to write a function that takes in a list of Numbers and returns the sum of the cubes of the numbers:
<span class="name">product</span>(lst :: List<Number>) -> Number:
<span class="keyword">doc</span>: <span class="string">"Return the product of the numbers in list lst"</span>
<span class="keyword"... n class="name">sum-of-cubes</span>(lst :: List<Number>) -> Number:
<span class="keyword">doc</s
, ''my-sum'').
<code>
fun my-product(lst :: List<Number>) -> Number:
doc: ```returns the product of the numbers in list lst```
cases (List) lst:
| empty => 1
| l... parts to write a function that takes in a list of Numbers and returns the sum of the cubes of the numbers:
Copy the unique ID – the long string of letters, numbers, and underscores – in the spreadsheet URL and us... >mins-since-midnight</span>(time :: String) -> Number:
...
<span class="keyword">end</span>
</code></... those in the table), it should convert it to the number of minutes since midnight.</p>
<p><strong>Hints</... cs/latest/strings.html#%28part._strings_string-to-number%29"><code>string-to-number</code></a>. Despite it
ine. For example, the command sleep waits a given number of seconds before continuing. Type
<code>compsci... ped in by the user; the next line, indicating job number and PID, is returned by the machine. The user is be notified of a job number (numbered from 1) enclosed in square brackets, together with a PID and is notified when a background proc
Copy the unique ID -- the long string of letters,
numbers, and hyphens -- in the spreadsheet URL and use i... (like those in the table) and converts it to the number of minutes
since midnight.</p>
<p><strong>Note</s... cs/latest/strings.html#%28part._strings_string-to-number%29"><code>string-to-number</code></a>. Despite
its name, the output is <em>not</em> a number! It's <c
Copy the unique ID -- the long string of letters,
numbers, and hyphens -- in the spreadsheet URL and use i... (like those in the table) and converts it to the number of minutes
since midnight.</p>
<p><strong>Note</s... cs/latest/strings.html#%28part._strings_string-to-number%29"><code>string-to-number</code></a>. Despite
its name, the output is <em>not</em> a number! It's <c
ur_clock|military time]],
e.g., 9:00 a.m. is the number ''0900'' and 6:00 p.m. is ''1800''.
If the time ... called. For example, this is valid code:
<code>
number = 111
if number == 111:
"Yay"
else:
"Nay"
end
</code>
==== Part 2 ====
Your friend came up with a... ite a function <code>saffir-simpson(wind-speed :: Number) -> String</code> that
takes in the average recor
ur_clock|military time]],
e.g., 9:00 a.m. is the number ''0900'' and 6:00 p.m. is ''1800''.
If the time ... called. For example, this is valid code:
<code>
number = 111
if number == 111:
"Yay"
else:
"Nay"
end
</code>
==== Part 2 ====
Your friend came up with a...
Write a function ''saffir-simpson(wind-speed :: Number) -> String'', that
takes in the average recorded
level))
; A toast is a
; (make-toast string number[0 to 10])
; where a toast’s kind can be any str... consumes a **''list-of-toast''** and produces the number of **''toast''**s in the list with the **''kind''... ignature/purpose/header: <code>; list-of-toast -> number
; counts the number of toasts in the list with the kind "white"
(define (count-white lot) ...)
</code> Be