代写 ; QUIZ 3 REMINDER AID SHEET Sunday October 6 DRAFT ; A program is a sequence of expressions and statements.

; QUIZ 3 REMINDER AID SHEET Sunday October 6 DRAFT ; A program is a sequence of expressions and statements.
; ! Expression Forms ! ; Literal Value
functionname ; function by name from a definition or from our language true false ; boolean
list literalvalue etc ; list
; insertedpasted image
n.n nn ; number as decimal or fraction characters ; text
; Variable Reference
variablename ; variable by name from a definition or from our language
; Function Call
functionname argumentexpression etc ; except lists
; ! Statement Forms !
; Definition of Variable or Function
define variablename valueexpression
define functionname parametername etc ; header
bodyexpression ; Assertion Test
same! expression expression
true! conditionexpression false! conditionexpression
; Reveal Algebraic Evaluation
stepexpression ;descriptionbelowassumesnoerroroccurs
functionname literalvalue etc ; except literal lists
; ! Equality Predicate : true! same? 1 1 2 false! same? 1 1 3 ; ! Type Predicates !
; ;
; ;
;
;
For a function from a definition: copy its body and substitute the arguments in place of the parameter names wherever the names occur in the body.
For combine or map : match its rules first pattern to determine f a b c … then substitute those into its rules second pattern the template.
map f list a b c etc listf af bf cetc
combine f list a b c etc f a b cetc
For any other function from our language: substitute directly computed value.
variablename literalvalue
Substitute the value that was computed when the variable was defined.
same! filledsquare same! filledoval
same! filledrectangle 9 same! width oval 9 15
same! above same! alignlefts same! alignrights
; ! Numeric Functions !
same! 2 10 3 15 same! 2 10 3 60

9 same! rectangle 9
true! function? flip true! boolean? false true! text? Hi!
true! list? list z true! number? 12
true! image?
; ! Function Predicates : true! unary? flip false! binary? flip ; ! List Functions !
same! list filledtriangle 9 zero? 0 2 3 hi list true 5 hi
same! map list 3 1 same! combine list
true! empty? list same! length list
7 list 3 1 7 3 1 7 11
true 5 hi 4
same! first list same! rest list same! reverse list
; ! Image Functions !
same! mirror same! flip
true 5 true 5 true

hi
hi list true 5 hi
5 hi list hi 5 true
same! rotate
same! clockwise same! anticlockwise

15 15 9

same! scale same! shrink
1.5
same! filledcircle
same! enlarge
same! filledtriangle 9

30

same! scalewidth
same! wider same! thinner
1.5
1.5

15
9 9
9
same! circle same! square
9 9
same! same! same!
12 12 12 3 9 12 3 4
same! inc 20 21 same! dec 20 19
true! zero? 0 false! positive? 3 true! positive? 12 false! positive? 0
; ! Text Functions !
same! textlength one 3 same! textjoin Hi human!
Hi human!
same! textimage Hi! same! textlist Hi!
list H i !

same! scaleheight
same! taller same! shorter
same! triangle 9

same! aligntops
same! alignbottoms
same! oval

same! height oval 9 15 15
same! beside

15