PasteRack.org
Paste # 97219
2020-09-15 03:49:46

Fork as a new paste.

Paste viewed 113 times.


Embed:

#lang racket

(module lifter racket

  (require (for-syntax racket/string))
  (provide my-top)
  (define-syntax (my-top stx)
    (syntax-case stx ()
      ((_ . id)
       (let* ((ids (symbol->string (syntax->datum #'id)))
              (ida (string-split ids "-")))
         (if (and
              (>= (length ida) 2)
              (string=? (car ida) "lift"))
             #`(curry map #,(datum->syntax stx (string->symbol (cadr ida))))
             #'(#%top . id)))
       )))
  )

(require (rename-in 'lifter (my-top #%top)))

(displayln
 (lift-add1 '(1 2 3)))