Assignment#1: Scheme
Handin procedure
- Your handin folder is in
~cs538-1/public/handin/proj1/login
where login
is your login name.
- Put your solutions in a SEPARATE FILE for each sub-part:
1a, 1b, 2a, 2b, 2c, 2d, 3, 4a, 4b, 5a, 5b, 5c
. You can also include a
file called README
with any notes about your submission,
especially analysis of the timing results for part 4b.
- Make each file SELF-CONTAINED. Don't load code used in
another question (e.g., loading file
2a
in the solution
for 3b
), and don't assume
that your code will execute in the handin folder. To achieve this, you
may
need to make copies of code that is common to multiple sub-parts of the
same
question.
- Each file should make available (at least) the Scheme functions
required by the
question. Here's the complete list of functions that need to be present
in each file. Note that you can have more functions defined, this are
just the minimum definitions required in each file:
1a: subsets
1b: filtered-subsets
2a: valid-bintree?
2b: equal-bintrees?
2c: tree-map
2d: ordered?
3: build-tree
4a: gen-list, pair-sum?
4b: int-seq, pair-sum-seq?
5a: make-sublists
5b: merge-sort
5c: merge-sort-cc?
-
Your submission must work correctly with DrScheme v208 installed
in the linux CS labs and available from the command prompt by typing
drscheme
(full path is /s/std/bin/drscheme
) with the
Textual (MzScheme, includes R5RS) language option. The language
option is set the first time DrScheme is run, but can be changed at a
later time by opening the Language menu and selecting the Choose
Language menu item. When prompted to select a language, open the PLT
bullet under the Professional Languages section, and select
the Textual (MzScheme, includes R5RS) option.
You are free to work on your own
with another version of DrScheme which you might
have downloaded and installed at home
(see drscheme.org)
but before submission, you must make sure your code
runs with our version of DrScheme.
You can
minimize problems by making sure you set the Language
to PLT/Textual MzScheme, includes R5RS.
if you use DrScheme library functions, please make
sure that these library functions are also available in DrScheme v208
installed here in CS.
- Your code will be tested for correctness using automatic scripts
and
a test suite. So please make sure that the code you submit does not
generate extraneous output by calling the
display
or write
or other Scheme output functions. Each of the functions listed in
bullet
4 above should silently return values as required by the
question. Also,
please make sure that your files are free of any top-level tests or
timings
that you may have used during development.
- You can assume that your functions will always be passed valid
input, so
you do not need to check, for example,
that the input argument is a list
or a number and so on unless the problem writeup states otherwise.
But your functions should be able to correctly
handle all valid input, including boundary conditions such as empty
lists.
- Your handins will be picked up by automatic scripts on the
midnight of the due date (March 28),
and then again on the midnights of each of the 7 allowed later days (Mar
29-Apr 4). Any files found in a handin folder by our scripts
on these 7 days will be deemed to be part
of a submission, and that handin folder will be made unwritable
immediately.
So if you plan to submit late, make sure that your handin directory
is empty
on the earlier submission days. You can also email the TA
to let him know that you are submitting late.
Grading criteria
The first and foremost criteria for grading is correctness. Your
programs
should execute without errors and produce the correct output with our
test
suite. Points are awarded for each test input successfully handled by
your
code.
You can use any algorithms or Scheme functions to produce the correct
output,
you are not restricted to following the path set by the questions. But
you
must follow the question when it comes to mandatory requirements, such
as
using continuations to exit early in Q.5(c) or lazy evaluation in Q.4
or not simply generating all subsets in Q.1(b).
No extra points for the most elegant programs but you are encouraged to
write
in a functional style, making best use of Scheme's natural
abstractions:
lists, recursion, higher-order functions, continuations, and so
on.
These will invariably reward you with compact, natural-looking code
which
is easy to read and understand. See the lecture notes and look online
for
Scheme programs to get a flavor of Scheme programming.
We will penalize programs that are excessively kludgy and hard to read
or
understand. Don't try to write C++ or Java in Scheme. In particular, the
excessive use of the update operator set!
(and its
relatives) is frowned upon and
will be penalized.
Partial credit will be given for programs that seem to be on the right
track.
Scheme Tips
First of all, check out the 538
Scheme
page for information on DrScheme and how to use it in the CS
Department.
Note that we have DrScheme v208 installed in the CS linux labs available
off of the command prompt by typing drscheme.
If you are using older versions of DrScheme, then
be aware of things that work differently in the older versions:
- When starting DrScheme for the first time, choose "PLT/Textual
(MzScheme,
includes R5RS)" as your Language. This will ensure that the full
version
of Scheme is available in DrScheme. This corresponds to the "Full
Scheme" language
option used in older DrScheme versions such as v101.
- To load a standard library, use the syntax
(require (lib
"library-name.ss"))
.
E.g., to trace through function execution, you need to load the tracing
library
like this: (require (lib "trace.ss"))
and then you can
call trace
and untrace
as usual. See the DrScheme
libraries for a complete list of all available libraries and what
they
provide. But make sure that any library functions are also available in
the version of DrScheme (v208) that is installed in CS.
- Check out the DrScheme
documentation page for all Scheme documentation. In particular, see
the DrScheme
Manual, the latest
Scheme Language Definition, and documentation for DrScheme
libraries.
- Written by Akash Lal, updated by Kevin Roundy, Mark Goadrich, Charles Fischer