7

In SICP section 3.4 (serializers in scheme) on Currency there is a procedure called parallel-execute that is described but not implemented in MIT scheme. I wonder if anyone has actually implemented it; if not how would one get started in implementing such procedure?

http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-23.html#%_sec_3.4.1

Mark
  • 8,408
  • 15
  • 57
  • 81

4 Answers4

8

This is how I implemented parallel-execute for solving the exercises in section 3.4 of SICP, using Racket:

(define (parallel-execute . procs)
  (map thread-wait
       (map (lambda (proc) (thread proc))
            procs)))

I can't guarantee that it has the same semantics as the parallel-execute procedure defined in the book, but it allowed me to solve the exercises.

Óscar López
  • 232,561
  • 37
  • 312
  • 386
7

This book's official site offers a implement parallel.scm. Open MIT Scheme like this:

mit-scheme -load PATH/parallel.scm

or put this

(load "PATH/parallel.scm")

at the head of your scheme source file.

tiga
  • 71
  • 1
  • 2
  • 3
    link broken as of april 2018. working link to parallel.scm [can be found here](https://mitpress.mit.edu/sites/default/files/sicp/psets/ps7/readme.html) – xdavidliu Apr 18 '18 at 19:59
3

Actually you can load all the necessary implementations in racket with the following package. Just type this in either the definitions or the interactions window and the necessary package will be installed and when you need it, include the same comment in the definitions window:

(require (planet dyoo/sicp-concurrency:1:2/sicp-concurrency))

Karthik.K
  • 63
  • 6
2

In GNU Guile the procedure is implemented as parallel. It is there defined as a special form and available from (use-modules (ice-9 threads)). If you want to implement it yourself, you may have a look at the source code of this module.