![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Introduction to Functional Programming in Scheme - slide 47 : 49 |
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'