Tutorial_00

advertisement
a00q4.rkt
(define my-tutorial-info (list ………))
MarkUs
Found under Assignments -> MarkUs
Do NOT use Internet Explorer (it does not work)
Ensure the filenames match the given filenames
E.g. “a00q4.rkt”, NOT “aOOq4.rkt”
Submit EARLY and OFTEN, NOT at the last minute
More information on the course website if you need
more help
Piazza
Discussion forum to ask questions and
clarifications about assignments and course
materials
All announcements about the course will be
posted on Piazza instead of course website.
Activate your account by following the link sent
to your UW email address
Removing Email
Messages
1. Top-right corner
2. Account/Email Settings
3. Scroll down to Class &
Email Settings
4. Click “No Emails” for
both options
5. Save Settings
Piazza Tips
Do
post any code related to
assignment questions
Do NOT post questions asking for someone to
debug your code:
E.g. “I get <some random error message> when I
run my program. Why is this happening?”
Read assignment CAREFULLY before posting on
Piazza. Your question may have already been
answered
Use Piazza search function to avoid repeated
questions
Use meaningful
names when posting
new topic
e.g. “Values consumed
for a01q3”, NOT “a01q3”
Purpose
;; (fn-name p1 p2 … pn) produces_____
Briefly describe what your function does
i.e how it uses the consumed values to produce the
produced values
Mention the names of your parameters
Do NOT copy and paste from the assignment
question. We WILL deduct marks!
Contracts - Overview
;; fn-name: Type1 Type2… Typen-> Produced_Value
Capitalize the first letter of each data type
Be specific:
Between Int, Num, Nat
Add requirements as needed: nonempty, >, <, >=,
<=, >=len, etc - be sure to mention parameter (by
name) that the requirement applies to
If data definitions are given, use them!
E.g. structures, lists etc.
;; A
is a list (list Str Sym Nat),
;; requires:
;; the first list value is the job title,
;; and it must be nonempty
;; the second list is the place of work
;; the third list item is the number of hours
;;
worked per week
;; fn-name: Type1 Job… -> Produced_Value
Iclicker Question
(define-struct module (lines test))
;; A Module is a (make-module Nat Nat)
Program is list of Module.
(create pa b)consumes a Program pa, and a non-negative
number b, it produces true if the total number of lines and
tests exceed b. Otherwise, it produces false.
Which one of the following expression for contract is
correct?
A.
B.
C.
D.
Nat Nat -> Bool
Program Nat -> Bool
(listof Module) Nat => Bool
Two of above is correct
Contracts Common Mistakes
Improper type names - check the Style Guide
e.g. Use Str, NOT string
Capitalization - e.g. Use Num, not num
Incorrect types
No restrictions
Wrong number of parameters
Use ->, NOT =>
Examples
;; Examples:
(check-expect (fn-name p1 p2 … pn) expected_output)
Always include at LEAST 2 examples for recursive data:
Base case
Non-base case
Tests
;; Description of test (i.e. what are you testing?)
(check-expect (fn-name p1 p2 … pn) expected_output)
Include ALL base cases and some non-base case tests
Include a test for every COND case
Be careful of nonempty list requirements – Don’t include
an empty case
Examples do not need to be repeated in your Racket tests
Style Mistakes
Whitespace:
Lines too long
No spacing between functions (too cluttered)
Use meaningful names for helper, parameters,
constants etc.
E.g. total-amt, not x
Simplify code as much as possible!
Use helper functions for repeated code
Tips
Check Piazza daily for any announcements
READ assignment carefully for any restrictions
E.g. no reverse, use local only, etc.
Check post on Piazza for allowable functions
Check public tests to see if your code works
WARNING: This is NOT a thorough testing of your code
Do NOT copy and paste anything directly from the pdf file.
Get help:
Instructor and ISA’s office hours
Set an appointment with us by email if the times don’t work:
cs116@uwaterloo.ca
Be careful of cheating!
NEVER show any student your code
Discuss verbally without taking notes
Penalty for cheating is 0 on that assignment and -5% on your
final grade, and possibly further disciplinary action
Good Luck!
Questions?
Download