Sew is a very simple language extension to reduce one or two levels indentation at the outermost level of a file. Using #lang sew and 8<-plan-from-here makes it easy to add and refactor boilerplate that surrounds a whole file without having to change the whole file's indentation.
#lang sew racket
(require (only-in sew 8<-plan-from-here))
[8<-plan-from-here [<> ...]
#'(begin
(provide main)
(define (main)
<> ...))]
(displayln "Hello, world!")
But the former makes it a little easier to write the file as though it were an imperative script.
More sophisticated uses of #lang sew could break up a file into multiple sections using a syntax/parse pattern and then use the same section in more than one place. For instance, here's a file that exports its "main" code as both a function and a syntax object while also having a "test" section that becomes a test submodule:
Sew
Sew is a very simple language extension to reduce one or two levels indentation at the outermost level of a file. Using
#lang sew
and8<-plan-from-here
makes it easy to add and refactor boilerplate that surrounds a whole file without having to change the whole file's indentation.The above is equivalent to this:
But the former makes it a little easier to write the file as though it were an imperative script.
More sophisticated uses of
#lang sew
could break up a file into multiple sections using asyntax/parse
pattern and then use the same section in more than one place. For instance, here's a file that exports its "main" code as both a function and a syntax object while also having a "test" section that becomes atest
submodule:The Sew documentation goes into some more detail about usage. The Sew codebase is on GitHub.
License
Yes.