Skip to content

Instantly share code, notes, and snippets.

View macroscope.js
macro $testadd {
case { $$mac $expr } => {
var ident = makeIdent('test', #{ $$mac });
return withSyntax ($ident = [ident]) {
return #{
return $expr + $ident;
}
}
}
}
@tuchida
tuchida / brainfuck.js
Created Mar 11, 2013
Brainfuck in sweet.js
View brainfuck.js
macro bf {
case ($body ...) => {
eval('var p = 0, b = [], buf = new Buffer(1);');
_bf($body ...);
}
}
macro _bf {
case (>) => {
eval('p++;');
}
@int3
int3 / gist:4027626
Created Nov 6, 2012
Chained comparisons using sweet.js
View gist:4027626
macro $if {
case ($x ...) => { if (relCar($x ...)) }
}
macro $while {
case ($x ...) => { while (relCar($x ...)) }
}
// naive form:
/*
@puffnfresh
puffnfresh / do.sjs
Created Oct 4, 2012
do-notation using sweet.js
View do.sjs
macro $do {
case { $y:expr } => {
$y
}
case { $x:ident <- $y:expr $rest ... } => {
λ['>=']($y, function($x) {
return $do { $rest ... }
});
}
}
@jimbojsb
jimbojsb / gist:1630790
Created Jan 18, 2012
Code highlighting for Keynote presentations
View gist:1630790

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

You can’t perform that action at this time.