Skip to content

Instantly share code, notes, and snippets.

@soegaard
Created June 12, 2013 11:16
Show Gist options
  • Save soegaard/5764462 to your computer and use it in GitHub Desktop.
Save soegaard/5764462 to your computer and use it in GitHub Desktop.
#lang racket
(require (for-syntax racket/list))
(define-syntax (foo stx)
(define (quote-it stx) (list 'quote stx))
(define name+xs (syntax->list stx))
(define name (first name+xs)) ; unused (is foo)
(define xs (rest name+xs))
(define result-as-list (cons 'vector (map quote-it xs)))
(datum->syntax stx result-as-list))
(foo x y z)
@soegaard
Copy link
Author

lang racket

(require (for-syntax racket/list))
(define-syntax (regs stx)
(define (quote-it stx) (list 'quote stx))
(define args (rest (syntax->list stx)))
(datum->syntax stx `(vector ,@(map quote-it args))))

(regs x y z)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment