Assignment - Click to edit Master subtitle style cs784(tk)...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Click to edit Master subtitle style cs784(tk) L123Assg Assignments and Procs w/Params cs784(tk) 11 cs784(tk) L123Assg Assignment, LHS := RHS l-value: left-, location, address, reference, r-value: right-, int, real, address, env and store allow one to describe the semantics of assignment in a purely functional style. (DENOTATIONAL SEMANTICS) Object language structures are mapped to similar Scheme structures. (META- cs784(tk) 22 cs784(tk) L123Assg Sharing sharing/aliasing Point p = new Point(); Point q = p; call by reference void f(Point p){}; f(q); cs784(tk) 33 cs784(tk) L123Assg Side-effects in Scheme Update variable: (set! var exp) denotes location denotes value In Scheme locations are denotable, but not expressible Sequencing: (begin exp1 exp2 expn) Ordering of expressions important cs784(tk) 44 cs784(tk) L123Assg Expressible vs. Denotable values Expressible Values the language can express and compute these represented in the language's syntax as expressions Denotable Values represented in syntax by declarations the names and their values saved within a data structure (called a namespace or environment or symbol table or activation record) CS784 55 SchemeRefresher cs784(tk) L123Assg Expressible vs. Denotable values Booleans are expressible in (early) FORTRAN, but not denotable. Functions are denotable in many languages, but are not expressible. In (functional subset of) Scheme, both value spaces are identical. In (full) Scheme, variable references (pointers) are denotable but not expressible. CS784 66 SchemeRefresher cs784(tk) L123Assg Local Binding: let ( let proc-id ([ id init-expr ] ...) body ...+) Defines a local procedure. Evaluates the init-expr s; these become arguments to the proc. The id s must be distinct. (let fac ([n 10]) (if (zero? n) 1 (* n (fac (sub1 n))))) m 3628800 CS784 77 SchemeRefresher cs784(tk) L123Assg Local Binding: let* ( let* ([ id val-expr ] ...) body ...+) Similar to let , but evaluates the val-expr s one by one, creating a location for each id as soon as the value is available....
View Full Document

Page1 / 40

Assignment - Click to edit Master subtitle style cs784(tk)...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online