This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func cdr<L, R>(p: () -> (L,R)) -> R { | |
let (l,r) = p() | |
return r | |
} | |
func car<L, R>(p: () -> (L,R)) -> L { | |
let (l,r) = p() | |
return l | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// found this perl in "The Seasoned Schemer". | |
// just love how simple this implementation while coming | |
// with really great features. | |
function empty_table() {} | |
function extend(table, key, value) { | |
return function(k) { | |
if(k === key) { | |
return value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LazyList(): | |
def __init__(self, iterable): | |
self._list = [] | |
self._iterable = iter(iterable) | |
self._has_thrown = False | |
self._current_index = 0 | |
def __iter__(self): | |
return self |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Either | |
data Term = TTrue | |
| TFalse | |
| TIf Term Term Term | |
| TZero | |
| TSucc Term | |
| TPred Term | |
| TIsZero Term |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Reducer a r = r -> a -> r | |
type Transducer a b = forall r. Reducer a r -> Reducer b r | |
class Conjable f where | |
empty :: f a | |
conj :: Reducer a (f a) | |
class Foldable f where | |
fold :: Transducer a (f a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Reducer<a, r> extends Function { | |
(z : r, x : a) : r; | |
} | |
interface Transducer<a, b> extends Function { | |
<r>(red : Reducer<a, r>) : Reducer<b, r>; | |
} | |
interface Unary<a, b> extends Function { | |
(x:a):b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# flatten :: [[a]] -> [a] | |
def flatten(l): | |
return [x for lx in l for x in lx] | |
# first :: [a] -> a | |
def first(l): | |
return [l[0]] if l else [] | |
# toString :: [Char] -> String | |
def toString(l): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var foo = { | |
"bar": { | |
"x": "test", | |
"y": 3 | |
}, | |
"list": [1, 2, 3, 4], | |
"obj_list": [ | |
{ | |
"x": "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MAX_ITEMS = 360; | |
var PAGE_SIZE = 10; | |
var PAGE_LOAD_THRESHOLD = 1 * 1000; | |
function AsyncRunner(options) { | |
var self = this; | |
var tasks = []; | |
var intervalIndex = -1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module either { | |
export interface Either<L, R> { | |
isLeft():boolean; | |
isRight():boolean; | |
left():L; | |
right():R; | |
either<a>( | |
fl:(l:L)=>a, |
OlderNewer