~cs538-1/public/handin/proj4/login
where login
is your login name.1,2, 3, 4
. You can also include a file called
README
with any notes about your submission.
A note about the printN
function: it should print the members of a lazy list separated by spaces and terminated by a newline. So the list "1,2,3,4" should print as "1 2 3 4" (on a separate line). The null list should print as a blank line. Extra spaces and tabs are fine, just make sure that all list elements are separated by white space and on the same line.
Also note that there is no requirement of a specific exception to be raised by function Nth
, any reasonable one will do, even a user-defined one.
Our tests will catch whatever exception you raise.
Question | Required definitions |
---|---|
1,2 |
class LazyList { ... } //As defined in handout
also, any subclasses of LazyListFct required by your code.
|
3 |
class LazyList<T> { ... }
(with T as the type of the list element, and
with the same defined member functions as the Java class LazyList )
|
4 |
Define the following functions:
seq(first,last)
(return an ordinary list)
(return a value or raise an exception)
Here, all lazylists are to be represented using a list as specified in the handout. Null lists are represented by the empty list [] , lists of one element
are represented by the singleton list [val] ,
and longer lists by a 2-element list [val,fct]
where fct is a function that can be called
to yield the rest of the lazy list.
|
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 language features or libraries to produce the correct output, you are not restricted to following the exact path set by the questions.
No extra points for the most elegant programs but you are encouraged to write in a style natural to the language you use: classes and inheritance in Java and C#, parametric polymorphism and first-class functions in Pizza, and clasess, lists and lambdas in Python. These will invariably reward you with compact, natural-looking code which is easy to read and understand.
Partial credit will be given for programs that seem to be on the right track.
Language Tips
Check out the Language Links
page for information on each language.
setenv CLASSPATH .:/u/f/i/fischer/public/pizza/classes:/s/jdk1.0.2/lib/classes.zip alias pc 'java -ms8m pizza.compiler.Main'
pc LazyList.pizza pc Test.java java Test
setenv CLASSPATH . javac LazyList.java javac Test.java java Test
http://www.microsoft.com/express/download/default.aspx
http://www.mono-project.com/Downloads