data tempates lock innnnnnnnnn

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 6:56 AM on 10/7/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

12 Terms

1
New cards

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


2
New cards

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


3
New cards

whats in a basic atomic data def

  • TypeName is Type

  • interp comment

  • examples


4
New cards

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

5
New cards

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


6
New cards

whats in an interval template?

template looks like:

(define (fn-for-type-name n)

(… sn))

template rules used:

atomic-non-distinct


7
New cards

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


8
New cards

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


9
New cards

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


10
New cards

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

11
New cards

whats in a list definition?

  • typecomment: ListOfType is one of:

  • empty ;base case

  • (cons Type ListOfType) ;self-ref case

  • interp comment

  • examples


12
New cards

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)