Scheme

Scheme - CSC 4101 Programming Languages 1 1 Scheme Textbook...

Info iconThis preview shows pages 1–4. 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 Document Right Arrow Icon

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

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

Unformatted text preview: CSC 4101: Programming Languages 1 1 Scheme Textbook, Sections 13.1 – 13.3, 13.7 2 Functional Programming Based on mathematical functions Take argument, return value Only function call, no assignment Functions are first-class values E.g., functions can return functions Requires garbage collection 3 Lambda Calculus Mathematical functional language Language constructs – Variables: x – Primitive functions: * – Function abstraction: ( x ) x*x or x . x*x – Function call: f ( x ) or f x Example ( ( x ) x*x*x ) (2) yields 8 CSC 4101: Programming Languages 2 4 Scheme Dialect of LISP (from MIT, ca. 1975) Lists as built-in data type Same syntax for lists and programs Functions are (first-class) data Dynamic, strong typing Interaction ( read-eval-print ) loop 5 Scheme Syntax S-expressions s-expression ::= literals | symbols | ( s-expression . . . ) Special forms for specific language constructs 6 Atomic Data Types Numbers 3.14, 42, 4101 Booleans #t, #f Characters, Strings #\a, #\newline, "Hello World!" Symbols f, x, +, *, foo, bar, null?, set! CSC 4101: Programming Languages 3 7 Variable Definitions Variable definitions (define x 3) (define y 5) This is not an assignment!...
View Full Document

{[ snackBarMessage ]}

Page1 / 10

Scheme - CSC 4101 Programming Languages 1 1 Scheme Textbook...

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

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