www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

pmapf.rkt (357B)


      1 #lang racket
      2 
      3 ;pmap is a parallel concurrent map function.
      4 ;its inspired of Clojures pmap.
      5 
      6 (require racket/future)
      7 
      8 (provide pmapf)
      9 
     10 (define (transpose lists) ; collumns to rows!
     11   (apply map list lists))
     12 
     13 (define (pmapf func . lists) ; pmap
     14   (map touch
     15        (for/list ([a (transpose lists)])
     16          (future (lambda () (apply func a)))
     17          )))
     18 
     19