Skip to content

Instantly share code, notes, and snippets.

View gist:44f8572b863ed398a69a
macro m {
rule {} => {
(function() {
return
{
foo: "bar"
}
})
}
}
@disnet
disnet / import.js
Last active Aug 29, 2015
import macros
View import.js
// test.js
#lang "./macros/stxcase.js";
import { m } from "./mod.js";
m(10, 100)
// mod.js
#lang "./macros/stxcase.js";
View gist:8ba94ee2e5c8649f7c37
### Keybase proof
I hereby claim:
* I am disnet on github.
* I am disnet (https://keybase.io/disnet) on keybase.
* I have a public key whose fingerprint is 1CCB B2BE 266F 8706 733F C4A7 07DF 8A2D E8B1 D193
To claim this, I am signing this object:
@disnet
disnet / stxparm.md
Last active Aug 29, 2015
thoughts about syntax parameter
View stxparm.md

Syntax parameters allow us to play around with hygiene in a principled fashion.

stxParam it = function() { throw new Error("must be rebound"); };

let aif = macro {
    rule { ($cond ...) { $body ...} } => {
	var it_inner  = $cond ...;
	if (it_inner) {
View gist:9d216aee2442d737df35
let function = macro {
rule { $name (callback $arg $rest ...) { $body ... } } => {
function $name ($arg $rest ...) {
$body ...
}
}
}
function foo(callback cb, x, y, z) {
cb(x + y + z);
@disnet
disnet / highlight.sh
Created Oct 21, 2011
running pygments on the command line
View highlight.sh
pygmentize -f rtf -O fontface=Menlo -o examples.rtf examples.coffee
@disnet
disnet / let.coffee
Created Dec 5, 2011
let in coffeescript
View let.coffee
lets = (vals, fn) -> fn.apply @, vals
lets [1, [2, 3]], (a, [b, c]) ->
a is 1
b is 2
c is 3
View test.coffee
class HashMap
# non-implementation of a HashMap :)
get: (key) -> @[key]
put: (key, val) -> @[key] = val
HashMapC = (keyContract, valContract) ->
?{
get: ((keyContract) -> valContract)
put: (keyContract, valContract) -> Any
View gist:3147381
== Access of unallocated memory ==
address 0
at test_unallocated (file_name.js:3:0)
== Access of uninitialized memory ==
address 0
at test_unallocated (file_name.js:3:0)
== Free of unallocated memory ==
address 8184
You can’t perform that action at this time.