Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

pd8 hw15 2021-04-05 Alif Miah

worked with no one; advised by no one

rules to Racket by

capability sample Racket code Why would a form of the steps that Racket takes as it implements or provides
that uses the capability programmer language the capability
use this?
Racket can…

(define pi 3.14) To never type (define symbol 1. Check the symbol table for a slot
the same expression ) 2. Make a new slot for the symbol
…bind a value to a thing twice 3. Put the value in the symbol table
symbol

…retrieve a value (display pi) To never type (display 1. Check the symbol table
that was the same symbol 2. Retrieve the value from the symbol table
previously bound thing twice expression ) 3. Use the value
to a symbol

…evaluate an (display (* 4 3)) To calculate (display 1. Read the expression left to right
expression the value of an expression ) 2. Do the expression
expression

…build a (display To set a (display 1. Look at the parameter


procedure (lambda definition for (lambda 2. Build the expression with the variable
(r) changing (variable)
(* 3.14 r r) variable (expression)
) )
) )
…invoke a (display To never type (display 1. Look at the parameter(s)
procedure ( the same (lambda 2. Build the expression
(lambda thing twice ( 3. Replace the parameters with the arguments
(r) (variable) 4. Evaluate the expression
(* 3.14 r r) (expression)
) )
4 ) number to put
) in variable)
)

…produce dots of (display “hello” To use (define omitted for this capability, since that implementation is
light in the “values”) hidden inside how DrRacket works, and outside the
interactions scope of this course
window, to
represent a value
in a form that a
human can read

You might also like