(library (core define-values)
(export define-values)
(import (for (core primitives) run expand)
(for (core with-syntax) expand))
(define-syntax define-values
(lambda (form)
(syntax-case form ()
((_ (id ...) exp0 exp ...)
(with-syntax (((mutable-id ...) (generate-temporaries (syntax (id ...))))
((result ...) (generate-temporaries (syntax (id ...)))))
(syntax
(begin
(define mutable-id) ...
(define dummy
(call-with-values
(lambda () exp0 exp ...)
(lambda (result ...)
(set! mutable-id result) ...)))
(define id mutable-id) ...))))))))