#lang racket
(define (parallel-execute . thunks)
(for-each thread thunks))
(define x 10)
(parallel-execute (lambda () (set! x (* x x)))
(lambda () (set! x (+ x 1))))
(display x)
(newline)
(display x)
(newline)
(display x)
(newline)
(display x)
(newline)
(display x)
(newline)
(display x)
(newline)
(display x)
或者如下实现
(define (parallel-execute . procs)
(map thread-wait
(map (lambda (proc) (thread proc))
procs)))
http://planet.racket-lang.org/package-source/esilkensen/yaml.plt/2/1/private/serializer.rkt