www

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

commit 872c6e24dbd754ba9c0e453234a36f456ab9c6b2
parent 910204a2c757d4714d49853744053d2d93e2189e
Author: Andreas Olsson <photoguy.apo@gmail.com>
Date:   Wed, 28 Dec 2016 14:18:23 +0100

Add files via upload

A major change to the better. Thanks to Carl!
Diffstat:
Mpmap.rkt | 29+++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/pmap.rkt b/pmap.rkt @@ -5,24 +5,17 @@ (require racket/future) -(provide pmap1) -(provide pmap2) - -(define (pmap1 func alist) ; pmap for one list - (map touch - (for/list ([a alist]) - (future (lambda () (func a ))) - )) - ) - -;(pmap1 (lambda (x)(car x)) '((a b)(c d)(e f))) ; a test +(provide pmap) +(define (transpose . lists) ; collumns to rows! + (apply map list lists)) -(define (pmap2 func alist blist) ; pmap for two lists +(define (pmap func . lists) ; pmap (map touch - (for/list ([a alist][b blist]) - (future (lambda () (func a b))) - )) - ) + (for/list ([a (apply transpose lists)]) + (future (lambda () (apply func a))) + ))) -;(pmap2 (lambda (x y) (* x y)) '(1 2 3 4 5 6 7 8 9) '(1 2 3 4 5 6 7 8 9)) ; a test -\ No newline at end of file +;(pmap (lambda (x)(car x)) '((a b)(c d)(e f))) ; a test +;(pmap * '(1 2 3 4 5 6 7 8 9) '(1 2 3 4 5 6 7 8 9)) ; a nother test +;(pmap (lambda (x y) (* x y)) '(1 2 3 4 5 6 7 8 9) '(1 2 3 4 5 6 7 8 9)) ; yet a nother test! +\ No newline at end of file