Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kalimehtar/template
Macro that generate one-time macro for code generating
https://github.com/kalimehtar/template
Last synced: about 1 month ago
JSON representation
Macro that generate one-time macro for code generating
- Host: GitHub
- URL: https://github.com/kalimehtar/template
- Owner: Kalimehtar
- Created: 2013-01-04T20:11:08.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-01-04T20:37:51.000Z (about 12 years ago)
- Last Synced: 2024-10-16T03:02:20.050Z (3 months ago)
- Language: Common Lisp
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
template
========It can be used to generate code.
For example, you need to write something like
(defmethod ((a type1) b)
{some code})
(defmethod ((a type2) b)
{some code})
(defmethod ((a type3) b)
{some code})
defmethod don't give ypu a way to set list of types as a qualifier.You may write
(template type (type1 type2 type3)
`(defmethod ((a ,type) b)
{some code}))And you can cycle several vars at once:
(template (name type) ((name1 type1) (name2 type2) (name3 type3))
`(defmethod ((,name ,type) b)
{some code}))And, if simply it easier generate code, than write (for long cond, for example)
(template () ()
(this-function-returns-generated-code))
Or you may use it for macro-expansion time evaluation.(devfar sin1 (template () () (sin 1)))
will evaluate (sin 1) at compile-time and put the result as a constant value to defvar.Package TEMPLATE exports two symbols. You may either import template:template or simply use
(template:! ...)
The package is not intended to be in USE-PACKAGE