-
Notifications
You must be signed in to change notification settings - Fork 211
Example macros
egoarka edited this page Apr 14, 2018
·
52 revisions
Links to some example macros. If you've written a cool macro and want to share please add!
- basic hello
- let
- cond (better switch)
- class
- ML-like auto-curried function literals
- ML-like auto-curried functions with let
- contracts
- lambda-jam - shorthand function syntax, inspired by clojure's shorthand function macro
- CSP-style tasks and channels
- sweetreaction - macros for react
- haskell style do-notation
- fragment of scheme
- parameter annotations
- coffeescript's
do
syntax - coffeescript's
@
syntax - chained comparisons
- rudimentary enum
- y-combinator
- repo with lots of examples
- hygienic destructuring using the coffeescript-style
$do
macro - case matching
- cond (better switch)
- arrow functions
- for loops with
for(x <- items)
andfor(x, i <- items)
syntax - high-resolution timing macro for Node.js
- Array.prototype.filter-like method call expanded into an efficient loop
- various sugars for the Meteor framework
- tail call 'optimization'
- JSHint-clean array/object iterators & array comprehensions
- constexpr - evaluate expressions at compile time
- curried/partial - macros to curry and partially apply functions or macros.
nin
("not in") operator- argument threading operator
- function composition
- clojure style arity function