Matthias Felleisen wrote at 06/09/2012 11:24 AM:
Neil, do you mean something like this:

Robby answered my question in a subsequent message: the core contract combinators don't support saying arity "two arguments, possibly more, but not necessarily arbitrarily more".

Regarding what I'm doing with my code... I didn't mean all the values from a history from multiple applications of P1, but all the values from a multiple-value-return of a single application of P1. (See example below.) And I preferred to do it without "set!". And I'd prefer to make each of the multiple-value-return values from P1 a separate argument to P2. My code works close enough to how I want it to

The example below shows how I want the values passed from P1 to P2. (Note: the "display" forms represent nested contexts, though they don't show it, such as for handling unwinds and exceptions, so what they represent is not just interleaved expressions.)

#lang racket/base

(define (f p1 p2)
  (display "do-thing-1-here\n")
  (let ((multiple-value-result-of-p1 (call-with-values (lambda ()
                                                         (p1 'a))
                                                       list)))
    (display "do-thing-2-here\n")
    (begin0 (apply p2 'b 'c multiple-value-result-of-p1)
      (display "do-thing-3-here\n"))))

(f (lambda args (printf "~S\n" `(p1 ,@args)) (values 'd 'e 'f))
   (lambda args (printf "~S\n" `(p2 ,@args))))

Outputs:

do-thing-1-here
(p1 a)
do-thing-2-here
(p2 b c d e f)
do-thing-3-here

Neil V.

____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to