[SOLVED] ; Quiz 2 Reminder Aid Sheet Saturday September 28th Draft ; A program is a sequence of statements and expressions

$25

File Name: ;____Quiz_2__Reminder_Aid_Sheet_Saturday_September_28th_Draft____;_A_program_is_a_sequence_of_statements_and_expressions_.zip
File Size: 1139.82 KB

5/5 - (1 vote)

;Quiz 2Reminder Aid Sheet Saturday September 28th Draft; A program is a sequence of statements and expressions
;Statement Forms
;Definition of a Variable or a Function
define
variablename
expression ; role: the value expression for this definition
define
functionname parametername etc ; known as the header expression ; role: the body expression for this definition
;Show Algebraic Evaluation Steps
step expression
; The following description assumes the expression does not produce an error.
functionname literalvalue ; except literal lists ;For a function from a definition: find the function definition, copy its body,
; but substitute the literal argument values in place of the parameter names
; wherever those names occur in the body.
;Function map or combine : the two arguments are a function and a list,
;Type Predicates
same! function? flip true
same! image?true same! number? 12 true same! boolean? true true
;Function Functions
same! unary? flip true
same! binary? flip false ;List Functions
same! text? Hi! true
; ; ; ;
in particular a literal function name and a literal list with literal elements. Let f be the function name, and a b c the elements of the list.
The expression matches the first pattern in one of the boxes below. Substitute f and a b c . into the second pattern the rules template.
map f list a b c listf af bf c
combine f list a b c
same! clockwise same! anticlockwise
same! scale 1.5 same! scalewidth
same! scaleheight
f abc
;Any other function from our language: replace with directly computed value.
same! filledtriangle 9same!filledcircle 9same! filledsquare 9
same! filledoval 9 15same! filledrectangle 9 15
same! enlarge same! triangle 9
same!circle 9 same! square 9
same! oval 9 same! rectangle 9
same! beside
same! aligntops
variablenameliteralvalue
; For a variable substitute its value.
same! above
same! alignlefts same! alignrights

;ClaimAssertionTest
same! expression expression ;Expression Forms
;Literal Value
functionname ; function by name from a definition or from our language number ; in decimal or fraction form
; insertedpasted image
true false ; the two booleans
characters ; text list literalvalue etc ; list
;Variable Reference
variablename ; variable by name from a definition or from our language
;Function Callfunctionname
expression ; role: an argument expression for this function call
etc
;unless the function name is list and the expressions are literal values

same! height oval 9 15 15
same! list list
triangle 9 text? ;2 3
true 5
same! maplist 3 1 7 list 3 1 7
same! combinelist 3 1 7
11 ;Seeallsothedescriptionfor step.
same! length list
true 5 3
;Image Functionssame! mirror
same! flipsame! rotate

same! thinner same! wider same! shorter
same! taller same! shrink

1515
30

1.5
1.5

9
same! height above circle 10 square 20 30
same! width oval 9 15
same! width beside circle 10 square 20 30
; NumericFunctions same!30 2 10 42
same!10 3 5 150 ;Text Functions
same!123 123 same!12 3 9 same!12 3 4
same! inc 20 21 same! dec 20 19
same! textlength one same! textjoin Hi
same! textimage Hi! same! textlist Hi!
3
human ! Hi human!

list H i !
same! list? list Hi
true
same! alignbottoms

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] ; Quiz 2 Reminder Aid Sheet Saturday September 28th Draft ; A program is a sequence of statements and expressions
$25