Last active
April 25, 2019 20:49
-
-
Save vyzo/378ffd068b191c669606b25683d7c9bd to your computer and use it in GitHub Desktop.
import nesting for gerbil
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import (for-syntax :std/misc/list)) | |
(export group-in) | |
(defsyntax-for-import (group-in stx) | |
(def (expand-path top mod) | |
(syntax-case mod () | |
((nested mod ...) | |
(map (lambda (mod) (stx-identifier top top "/" mod)) | |
(flatten (map (cut expand-path #'nested <>) #'(mod ...))))) | |
(id | |
(identifier? #'id) | |
(stx-identifier top top "/" #'id)))) | |
(syntax-case stx () | |
((_ top mod ...) | |
(cons begin: (flatten (map (cut expand-path #'top <>) #'(mod ...))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment