Skip to content

Instantly share code, notes, and snippets.

@mattbierner
mattbierner / gist:3768458
Created September 23, 2012 01:25
Callable.js example
// Call notation
var slice = callable.callable(Array.prototype.slice);
slice([1, 2, 3, 4], 1, 3) -> [2, 3]
// Apply notation
var slicea = callable.applicable(Array.prototype.slice);
slicea([1, 2, 3, 4], [1, 3]) -> [2, 3]
// Call notation binding leading arguments
var sliceb = callable.callable(Array.prototype.slice, 1);
@mattbierner
mattbierner / gist:3223696
Created August 1, 2012 04:36
SSSF Overview
var t = sssf.compile("@s(:[1,])");
t('abc') -> 'bc'
t({}) -> 'object Object]'
@mattbierner
mattbierner / gist:3223669
Created August 1, 2012 04:27
Overview of SSF
ssf.format("Hello @", "world") -> "Hello world"
// Formatting from an object.
ssf.format("Member['a']:@a Member['c']['d']:@c.d", {'a':1, 'c': {'d': 2}})
-> "Member['a']:1 Member['c']['d']:2"
// Formatting from an array.
ssf.format("Array[0]:@0 Array[1]:@1", ['A', 3]) -> "Array[0]:A Array[1]:3"
@mattbierner
mattbierner / gist:2951898
Created June 19, 2012 02:00
Prosopon Factorial Example
let FactorialContinuation{val cust}<
case \arg: send val ('*' arg cust) ;
>
let Factorial <
case 0 \cust: send cust (1) ;
case \val \cust:
send val ('-' 1 <
case \result:
send Factorial (result FactorialContinuation{val cust})