Skip to content

Instantly share code, notes, and snippets.

@thunklife
Created January 16, 2014 15:33
Show Gist options
  • Select an option

  • Save thunklife/8456901 to your computer and use it in GitHub Desktop.

Select an option

Save thunklife/8456901 to your computer and use it in GitHub Desktop.
requirebin sketch
// hello world
var curry = require('fn-curry');
var conditional = curry(function(pred, succ, fail){
return function(){
var args = Array.prototype.slice.call(arguments);
return pred.call(this, args) ? succ.apply(this, args) : fail.apply(this, args);
};
});
var even = function (i){
return i % 2 == 0;
};
var ifEven = conditional(even);
var ifEvenAlertEvenElseAlertOdd = ifEven(alert.bind(this, 'even'), alert.bind(this, 'odd'));
ifEvenAlertEvenElseAlertOdd(3);
require=function e(r,n,t){function i(o,l){if(!n[o]){if(!r[o]){var a="function"==typeof require&&require;if(!l&&a)return a(o,!0);if(u)return u(o,!0);throw Error("Cannot find module '"+o+"'")}var c=n[o]={exports:{}};r[o][0].call(c.exports,function(e){var n=r[o][1][e];return i(n?n:e)},c,c.exports,e,r,n,t)}return n[o].exports}for(var u="function"==typeof require&&require,o=0;t.length>o;o++)i(t[o]);return i}({rG9F79:[function(r,e){var n=Array.prototype.slice;e.exports=function(r,e){return e=e||r.length,function t(){var i=n.call(arguments);return i.length===e?r.apply(this,i):function(){var r=n.call(arguments);return t.apply(this,i.concat(r))}}}},{}],"fn-curry":[function(r,e){e.exports=r("rG9F79")},{}]},{},[]);var curry=require("fn-curry"),conditional=curry(function(r,e,n){return function(){var t=Array.prototype.slice.call(arguments);return r.call(this,t)?e.apply(this,t):n.apply(this,t)}}),even=function(r){return 0==r%2},ifEven=conditional(even),ifEvenAlertEvenElseAlertOdd=ifEven(alert.bind(this,"even"),alert.bind(this,"odd"));ifEvenAlertEvenElseAlertOdd(3);
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; }
body, html { height: 100%; width: 100%; }</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment