<HTML><BODY>Thank you!<br><br><br>Sat, 28 Jun 2014 09:41:38 +0200 от "Jos Koot" <jos.koot@gmail.com>:<br>
<blockquote style="margin: 10px; padding: 0px 0px 0px 10px; border-left-color: rgb(8, 87, 166); border-left-width: 1px; border-left-style: solid;">
<div>
<div class="js-helper js-readmsg-msg">
<style type="text/css"></style>
<div>
<base href="https://e.mail.ru/" target="_self">
<div id="style_14039413160000000654_BODY">#lang racket<br>
<br>
(define-syntax (set!-values* stx)<br>
(syntax-case stx ()<br>
((_ (var ...) values-expr)<br>
(with-syntax (((local-var ...) (generate-temporaries #'(var ...))))<br>
#'(let-values (((local-var ...) values-expr))<br>
(set!* var local-var) ...)))))<br>
<br>
(define-syntax (set!* stx)<br>
(syntax-case stx ()<br>
((_ var val) (free-identifier=? #'var #'_) #'foid)<br>
((_ var val) #'(set! var val))))<br>
<br>
(define foid (void))<br>
<br>
(define-values (a b c) (values 1 2 3))<br>
(set!-values* (_ _ c) (values 4 5 6))<br>
(list a b c)<br>
<br>
Jos<br>
<br>
<br>
________________________________<br>
<br>
From: users [mailto:users-bounces@racket-lang.org] On Behalf Of<br>
Roman Klochkov<br>
Sent: sábado, 28 de junio de 2014 8:43<br>
To: Racket Users List<br>
Subject: [racket] Please help with syntax<br>
<br>
<br>
I need to define syntax set!-values*, that will ignore _ in value<br>
place.<br>
<br>
Such as<br>
(define a #f)<br>
(set!-values* (_ _ a) (values 1 2 3)) ; should set a to 3.<br>
<br>
But I have two problems:<br>
1. _ don't want to pattern match in syntax case. If I make it<br>
literal, I can't match "anything else".<br>
2. How to omit extra values. It seems that in any case I have to<br>
assign them to something...<br>
<br>
Can you help me? I hope, that my problem in fact not hard, but I<br>
have not enough experience to solve it.<br>
<br>
-- <br>
Roman Klochkov <br>
<br>
<br>
</div>
<base href="https://e.mail.ru/" target="_self">
</div>
</div>
</div>
</blockquote>
<br>
<br>-- <br>Roman Klochkov<br></BODY></HTML>