Skip to content

Instantly share code, notes, and snippets.

@lune-sta
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save lune-sta/fb49e796e56f4c29a195 to your computer and use it in GitHub Desktop.

Select an option

Save lune-sta/fb49e796e56f4c29a195 to your computer and use it in GitHub Desktop.
(define-syntax-rule
(CGpipeline cg prev-value init-value body ...)
(match cg
[(CG id np pls)
(define (send-value v)
(place-channel-put (list-ref pls (add1 id)) v))
(define prev-value
(if (= id 0)
init-value
(place-channel-get (car pls))))
(define result (begin body ...))
(unless (= id (sub1 np)) (send-value result))
result]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment