Glad it was useful! There is a variant `in-value*/expression` that works like your `in-values`: https://docs.racket-lang.org/adjutor/Stable.html#(form._((lib._adjutor%2Fmain..rkt)._in-value*%2Fexpression))
-Philip On Mon, May 4, 2020 at 10:12 PM Jos Koot <[email protected]> wrote: > To Philip McGrath, Hi again > > > > I modified the clause > > ((id ...) (in-value* expr ...)) > > to the following in-values clause: > > ((id ...) (in-values expr)) > > > > where the expr is supposed to return as many values as ids. > > I simplified the code such as to avoid syntax-parse, > > because I do not (yet) understand all its powerful features. > > I prefer writing code I can understand in all details. > > 😉 I should study on syntax-parse in due future 😉 > > > > (define-sequence-syntax in-values > > (λ (stx) > > (raise-syntax-error 'in-values > > "can only be used in for forms" stx)) > > (λ (stx) > > (syntax-case stx () > > (((id ...) (_ expr)) > > #'((id ...) > > (:do-in > > (((id ...) expr)) > > #t () #t () #t #f ())))))) > > > > For example: > > > > (for/first (((a b c) (in-values (values 2 + 3)))) (b a c)) ; -> 5 > > > > Thanks again, Jos > > > > *From: *Philip McGrath <[email protected]> > *Sent: *04 May 2020 17:21 > *To: *Jos Koot <[email protected]> > *Cc: *[email protected] > *Subject: *Re: [racket-users] multiple-value version of in-value > > > > My package `adjutor` has a few variants of this, like `in-value*`: > https://docs.racket-lang.org/adjutor/Stable.html#(part._.Sequence_.Constructors) > > > > They can all be used as first-class procedures, but that does involve a > little runtime overhead, so they use `define-sequence-syntax` to cooperate > directly with `for`-like forms when possible. > > > > -Philip > > > > > > > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAH3z3gZdxzaUgWqqhM4PzYT%3DozckGrUsaHh8OXFDH74mfEutHg%40mail.gmail.com.

