Lecture overview -- Keyboard shortcut: 'u'  Previous page: Imperative Programming in a Functional Language -- Keyboard shortcut: 'p'  Next page: Jumps in Functional Programs -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 3 - Page 14 : 43
Programming Paradigms
Simulation of other Paradigms and Continuations
Sequential Control

Evaluation order is very liberal in functional programming languages

Can we deal with sequential order, as known from imperative programming languages?

  • Begin C1; C2 End

    • Classical, Algol-like syntax for sequential execution. C1 first, next C2.

  • {C1; C2;}

    • A block in C that ensures sequential composition of two commands C1 and C2.

  • E1, E2

    • An expression with the comma operator that ensures sequential evaluation of of two expressions E1 and E2.

  • ((lambda (a b) unused) C1 C2)

    • Using parameters to a non-curried lambda expression - does not work

    • The evaluation order of C1 and C2 is not known

  • ((lambda (unused) C2) C1)

    • The actual parameter C1 is evaluated - and bound to unused - before the evaluation of C2.

    • The rule in languages with applicative order evaluation - such as Scheme

  • (begin C1 C2)

    • A Scheme special form (library syntax) for sequential composition

    • The value of (begin C1 C2) is the value of C2

      • Similar to the comma operator in C

    • Rarely useful in functional programming