1/11
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
what’s in an enumeration definition?
go straight to type comment, which employs the one of rule
then give each example (these should all be atomic distinct
interp comment
examples are redundant for enumerizations
what does the enumeration template look like?
to start, its a cond statement
where each Q/A pair is [(atomic-distinct predicate) (…)]
last case should be else
the template rules used were:
one-of
atomic-distinct
whats in a basic atomic data def
TypeName is Type
interp comment
examples
whats in a basic atomic data template
if non-distinct
(define fn-for-type-name x)
(… x))
if distinct
(define fn-for-type-name x)
(… )
the template rules are either distinct or non-distinct
what’s in an interval data def
used when you have two or more types of data and at least one is non-distinct
type comment looks like TypeName is (one of the number types) (0, 10]
interp comment
examples, one for each edge one for middle
whats in an interval template?
template looks like:
(define (fn-for-type-name n)
(… sn))
template rules used:
atomic-non-distinct
whats in an itemization definition?
TypeName is one of
list every thing it could be, note the atomic distinctness of each one
interp comment
examples
whats in an itemization template?
itemization templates are conds
where each Q/A pair is [(atomic-___distinct predicate) (… (x))]
last case should be else
template rules used:
always have used one-of
and then at least one atomic-nondistinct
and likely an atomic-distinct
be aware of guards
what’s in a compound data definition
above the type comment, do a (define-struct type (field field))
then do the type comment TypeName is (make-struct Type Type)
interp comment
examples
whats in a compound data template
compounds dont use a cond, instead, use a selector for each field
(define (fn-for-player p)
(… (type-name-field t)
(type-name-field t)))template rules used:
compound
whats in a list definition?
typecomment: ListOfType is one of:
empty ;base case
(cons Type ListOfType) ;self-ref case
interp comment
examples
whats in a list template
(define (fn-for-lot lot)
(cond [(empty? los) (...)]
[else
(... (first los)
(rest los))]))template rules used:
one of
atomic-distinct ;empty
self-ref ;(cons Type ListOfType)