Hi guys,
I’ve been wracking my brains all day trying to come up with a macro that would 
convert this syntax:

;; (aux a (b (* 2 pi)) c (d pi))
;; => (define-values (a b c d) (values #f 6.28318530717958 #f 3.141592653589793)


I’m missing some part of the picture. The closest I’ve come is to create a list 
of the pairs:

#lang racket

(define-syntax (aux stx)
  (syntax-case stx ()
    [(_ (var val)) #'`((var ,val))]
    [(_ var) #''((var #f))]
    [(_ (var0 val0) var1 ...) #'(append `((var0 ,val0)) (aux var1 ...))]
    [(_ var0 var1 ...) #'(append '((var0 #f)) (aux var1 ...))]))

(aux a (b (* 2 pi)) c (d pi)) ;=> '((a #f) (b 6.283185307179586) (c #f) (d 
3.141592653589793))


Any help is greatly appreciated!

Kevin

-- 
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 racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/AC605DEF-0AC6-4590-B53F-700C6AE14D4D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to