Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

implement parallel execute in scheme

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

like image 337
Mark Avatar asked Nov 20 '12 06:11

Mark


1 Answers

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.

like image 110
Óscar López Avatar answered Oct 05 '22 00:10

Óscar López