Delimiter-Sensitive Application
This library provides a definition of function application (an #%app macro) that changes meaning depending on whether parentheses, brackets, or braces are used. By default parentheses mean normal function application, brackets construct a list, and braces construct a hash. Also included is an optional delimit-app/fancy-app module that provides out-of-the-box integration with fancy-app.
1 API Reference
(require delimit-app) | package: delimit-app |
syntax
(delimit-app v ...)
> (delimit-app + 1 2 3) 6
> [delimit-app + 1 2 3] '(#<procedure:+> 1 2 3)
> {delimit-app + 1 2 3} '#hash((2 . 3) (#<procedure:+> . 1))
syntax
(delimit-app-base-app v ...)
syntax
(delimit-app/paren v ...)
syntax
(delimit-app/bracket v ...)
syntax
(delimit-app/brace v ...)
- Ordinary function application in terms of delimit-app-base-app for parentheses.Example:
> (delimit-app/paren + 1 2 3) 6
- List construction in terms of delimit-app-base-app and list for brackets.Example:
> (delimit-app/bracket + 1 2 3) '(#<procedure:+> 1 2 3)
- Hash construction in terms of delimit-app-base-app and hash for braces.Example:
> (delimit-app/brace + 1 2 3) '#hash((2 . 3) (#<procedure:+> . 1))
> (syntax-parameterize ([delimit-app/brace (make-rename-transformer #'delimit-app/paren)]) (delimit-app/brace + 1 2 3)) 6
Note that these forms completely ignore the 'paren-shape syntax property, which is only used by delimit-app to dispatch to the correct syntax parameter.
> {delimit-app/paren + 1 2 3} 6
2 Integration with fancy-app
(require delimit-app/fancy-app) | package: delimit-app |
syntax
(delimit-app/fancy-app v ...)