Daniel-Nikpayuk_SICP-Solutions/Chapter 3/3.4/exercise-3.40/exercise.lsp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Copyright 2015 Daniel Nikpayuk
;;
;; This file is part of SICP Solutions.
;;
;; SICP Solutions is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
;;
;; SICP Solutions is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
;; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License along with SICP Solutions. If not, see
;; <http://www.gnu.org/licenses/>.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define x 10)

(parallel-execute (lambda () (set! x (* x x)))
                  (lambda () (set! x (* x x x))))

;p1:100
;p2:1000

;1: p1 then p2
;p1:100
;p2:1000000

;2: p2 then p1
;p2:1000
;p1:1000000

;3: (* x p2 x)
;p2:1000
;p1:(* 10 1000):10000

;4: (* x x p2)
;p2:1000
;p1:(* 10 10):100

;5: (* x p1 x x)
;p1:100
;p2:(* 10 100 100):100000

;6: (* x x p1 x)
;p1:100
;p2:(* 10 10 100):10000

;7: (* x x x p1)
;p1:100
;p2:(* 10 10 10):1000

;100,1000,10000,100000,1000000

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Only the first two remain after serialization, both with the answer 1000000.

