Skip to content

Instantly share code, notes, and snippets.

@dyoo
Last active December 12, 2015 02:29
Show Gist options
  • Select an option

  • Save dyoo/4699554 to your computer and use it in GitHub Desktop.

Select an option

Save dyoo/4699554 to your computer and use it in GitHub Desktop.
An answer to mithos28's question in http://racket-lang.org/irc-logs/20130201.txt at 2:19
#lang racket
(require unstable/sequence)
(define los (list '(1 2 3)
'("a" "b" "c")))
(define (f elts)
(format "I see: ~s" elts))
(define result
(sequence-lift f
(in-values-sequence (apply in-parallel los))))
;; Under Racket HEAD (2e8ffe74002e3de0a929c8786ac683e509dc2494)
;; you won't need to do the in-values-sequence stuff, but
;; should be able to say this more directly:
;;
;; (define result (sequence-lift (lambda args args) (apply in-parallel los)))
;;
;; where, under HEAD, sequence-lift knows how to deal with multiple values
(for ([x result])
(displayln x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment