Lecture overview -- Keyboard shortcut: 'u'  Previous page: Referential Transparency [Section] -- Keyboard shortcut: 'p'  Next page: Referential Transparency -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Introduction to Functional Programming in Scheme - slide 47 : 49

Referential Transparency - Practical Aspects

We will illustrate the idea of referential transparency in the context of practical Scheme Programming

(let ((a (list 1 2))
      (b (list 1 2))
      (c (list 3 4)))
  (append a b c))            <==>

(let ((a (list 1 2))
      (c (list 3 4)))
  (append a a c))            <==>

(let ((a (list 1 2)))
  (append a a (list 3 4)))   <==>

(let ((a (list (- 3 2) 2))
      (b (list 1 (+ 1 1))))
  (append a b (list 3 4)))   <==>

(list 1 2 1 2 3 4) 

A copy of some data can be used as a substitute for the original data

A value of an expression can be used as a substitute for the expression itself

A 'more complicated expression' can be used as a substitute for 'the original expression'