; This file provides set-ec and :set. They were put in this file
; in order to avoid any the prefix from, say,
;   (require (prefix set: (planet "" ("cce" "galore.plt" 1))))

(module comprehensions mzscheme
  (require (prefix set: "")
           (lib "" "srfi"))
  (provide set-ec :set)
  (require (lib "" "srfi"))
  (define-syntax set-ec
    (syntax-rules ()
      [(_ empty etc1 etc ...)
       (fold-ec empty etc1 etc ... set:insert)]))
  (define-syntax :set
    (syntax-rules (index)
      ((:set cc var (index i) arg)
       (:parallel cc (:stack var arg) (:integers i)) )
      ((:set cc var arg)
       (:do cc
            (let ())
            ((s arg))
            (not (set:empty? s))
            (let ((var (set:select s))))
            ((set:remove var s))
  (define (:set-dispatch args)
      [(null? args)
      [(and (= (length args) 1)
            (set:set? (car args)))
       (:generator-proc (:set (car args)))]
   (dispatch-union (:-dispatch-ref) :set-dispatch)))