PasteRack.org
Paste # 76829
2018-02-12 12:02:20

Fork as a new paste.

Paste viewed 34 times.


Embed:

  1. #lang racket
  2.  
  3. (require (for-syntax racket/string))
  4.  
  5. (define-syntax (hyphen-define/many/ok1 stx)
  6.   (syntax-case stx ()
  7.     [(_ (component0 component ...) (args ...) body0 body ...)
  8.      (with-syntax ([name
  9.                     (datum->syntax
  10.                      stx
  11.                      (string->symbol
  12.                       (string-join
  13.                        (for/list ([component-stx (in-list
  14.                                                   (syntax->list #'[component0 component ...]))])
  15.                          (symbol->string (syntax->datum component-stx)))
  16.                        "-")))])
  17.        #'(define (name args ...)
  18.            body0 body ...))]))

=>