This file contains 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
const S = { | |
fromArray: xs => sink => { | |
for (let i=0; i<xs.length; ++i) | |
if (sink(xs[i])) | |
return true | |
}, | |
map: fn => stream => sink => stream(x => sink(fn(x))), |
This file contains 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
const meta = Symbol('@@ramda-meta'); | |
const initMeta = f => ({ func: f, arity: f.length, seenArgs: [] }); | |
const getMeta = f => f[meta] || initMeta(f); | |
const setMeta = (arg, f) => { | |
const fMeta = getMeta(f); | |
f[meta] = { | |
func: fMeta.func, |
This file contains 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
const fl = require('fantasy-land') | |
//- Lazy holds a vaue in a thunk, effectively delaying | |
//- evaluation until required. This is useful when we're | |
//- in a situation with either very large data set or | |
//- cyclical data. | |
//@ make stack-safe. | |
//> type Lazy a = Unit -> a | |
function Lazy(run) { |
This file contains 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
// first try: | |
R.cc = R.curry(function cc(f, g) { | |
return R.curryN(g.length, function() { | |
var gargs = Array.prototype.slice.call(arguments, 0, g.length); | |
var fargs = Array.prototype.slice.call(arguments, g.length); | |
return f.apply(this, [g.apply(this, gargs)].concat(fargs)); | |
}); | |
}); | |
// so this works: |
This file contains 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
#grid { | |
border: 1px solid #000; | |
border-spacing:0; | |
} | |
#grid tr:nth-child(3) td, | |
#grid tr:nth-child(6) td { | |
border-bottom: 1px solid #000; | |
} |
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<style> | |
#wrapper { | |
height: 200px; | |
padding: 20px; | |
background-color: #ddeeff; | |
} | |
#vector { |
This file contains 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
// assuming we have indexedDB | |
var version = 3; | |
var dbConn = indexedDB.open("db", version); | |
var db; | |
dbConn.onerror = function(e) { | |
console.log('error connecting to be'); | |
}; | |
dbConn.onsuccess = function(e) { |
This file contains 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
// currently in Ramda: | |
var compose = R.compose = function() { // TODO: type check of arguments? | |
var fns = slice(arguments); | |
return function() { | |
return foldr(function(fn, args) {return [fn.apply(this, args)];}, slice(arguments), fns)[0]; | |
}; | |
}; | |
//... | |
var useWith = R.useWith = _(function(fn /*, tranformers */) { |
This file contains 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
// require("ramda"); | |
var gens = (function() { | |
var trampoline = function(fn) { | |
var result = fn.apply(this, tail(arguments)); | |
while (typeof result == "function") { | |
result = result(); | |
} | |
return result; | |
}; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.