functions that computes all the permutations of a list of numbers
* Be sure to write tests for each fu... , before you move on to the function of your wish list
* Have a total of four functions by the time yo... --
==== Background ====
The permutations of a list of numbers is the list of all possible sequences of those numbers. We will represent the permutations o
(e.g., ''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
| link(f, r) => f * my-product(r)
end
where:
my-product(empty) is ...
my-product([list: 2, 3]) is ...
my-product([list: 5, 2, 3]) is .
(e.g., ''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
| link(f, r) => f * my-product(r)
end
where:
my-product(empty) is ...
my-product([list: 2, 3]) is ...
my-product([list: 5, 2, 3]) is .
ems, we will tell you whether to use the built-in list operations (like <code>map</code> and <code>filte... ef="https://www.pyret.org/docs/latest/lists.html">List documentation</a></li>
<li><a href="https://www.c... ask</strong>: Split <code>book-text</code> into a list of words, using Pyret’s <a href="https://www.pyre... split-all</code></a> function. Name the resulting list of words <code>split-text</code>.</p>
</div>
<h
amples for this lab ====
A **''toast''** and **''list-of-toast''** are defined as follows:
(define-s... but not limited to) “white” or “wheat”.
\\
; A list-of-toast (lot) is either
; - '()
; - (cons toast lot)
\\ Here's an example of a **''list-of-toast''** that you should use in your examples... tions you write: \\
<code scheme>
(define toast-list
(list (make-toast "white" 0)
(make-toas
any levels down to expand the tree, and returns a list of the possible nodes at that depth. A real game ... ram would then perform some computation over that list of nodes to select which move to make next.
Firs... 'lookAhead'' on a node at depth 0 should return a list containing only the node (irregardless of whether... n if we so chose.
==== 6.1 Using Java’s Built-In List Classes ====
Actually, this is a good opportunit
Exercises **
- Design a function that sorts a list of strings in ascending order. It will be a lot l... ction we designed in class this week that sorts a list of numbers. Be sure to follow the Design Recipe, ... de hand-in artifacts:
- Data Definition for a list-of-string
- you will find it useful to defi... der
- Template for a function that consumes a list-of-string
- Signature/Purpose Statement/Heade
n the table itself, let’s pull them out and get a list of all the free-text observations.</p>
<div clas... all-observations</span>(squirrels :: Table) -> List<String>:
...
<span class="keyword">end</span>
</pre>
<p>that returns a list of all the observation strings from the three col... – instead, think how you can use Pyret’s built-in list functions:</p>
<ul>
<li><code>append</code> (or <
e familiar with DrRacket procedures
* Use cons, list and append
* Use map
* Use let*
=== Procedu... ite a similar set of expressions for the built-in LIST and APPEND functions.
Review the definitions for LIST and APPEND in DrRacket documentatioin.
Comment ... r '(map (lambda (subsetlist)
(list (first subsetlist) (second subsetlist)))
er
for all time, not just for this snapshot.
- List the order number and total dollars of all orders.
- List the last name and home city of people whose prefix is "Dr.".
- List id, name, and price of products with quantity more than 1007.
- List the first name and home city of people born in th
1 Listing files and directories ====
__**ls**__ (list)
When you first login, your current working dire... them unless you are very familiar with Linux!
To list all files in your home directory including those ...
<code>compsci-user@tim:~$ ls testdir</code>
to list the contents of your //testdir// directory.
Now ... rrect directory, or specify its full pathname. To list the contents of your backups directory, you must
s rights on directories.===
* r allows users to list files in the directory;
* w means that users ma... kgrounded or suspended, it will be entered onto a list along with a job number. To examine this list, type
<code>compsci-user@tim:~$ jobs</code>
An example of a job list could be
* [1] Suspended sleep 100
* [2] Run
uff directory, type
<code>compsci-user@tim:~$ ls list*</code>
This will list all files in the current directory starting with **list....**
Try typing
<code>compsci-user@tim:~$ ls *list</code>
This will list all files in the current d
a command. For example, to create a file called **list1** containing a list of fruit, type
<code>compsci-user@tim:~$ cat > list1</code>
Then type in the names of some fruit. Pr... h normally goes to the screen, into a file called list1
To read the contents of the file, type
<code>c