duplicates = multiple editions
A Classical Introduction to Modern Number Theory,Kenneth IrelandMichael Rosen
A Classical Introduction to Modern Number Theory,Kenneth IrelandMichael Rosen
//-- If you understand closures - you know why this will always return true | |
function f(value) { | |
return (function (copy) { | |
return copy === value; | |
}(value)); | |
} |
//-- http://allong.es/try/ | |
tap = allong.es.tap | |
flip = allong.es.flip | |
curry = allong.es.curry | |
compose = allong.es.compose | |
call = allong.es.call | |
//-- square :: Int -> Int | |
function square(x) { return x*x } | |
// Ideas | |
//-- note (() -> IO), random function | |
//-- Maybe denote it with a lambda instead | |
//+ given :: (a -> Bool) -> (() -> IO) -> Maybe IO | |
//+ ifthen :: (a -> Bool) -> (() -> IO) -> Maybe IO | |
function ifthen(predicate, action) { | |
if (predicate()) { | |
action(); |
var bind = Function.prototype.call.bind(Function.prototype.bind); | |
var call = bind(Function.prototype.call, Function.prototype.call); | |
var apply = bind(Function.prototype.call, Function.prototype.apply); |
//-- Example 1 -------------------------------------------------------- | |
//-- Note - We do not need to reference the data `email` when | |
//-- using a 'Point free style' of programming | |
//-- Note - `curry` is from Prelude. `compose` is from Oliver Steele -- | |
//-- http://preludels.com/ | |
//-- http://osteele.com/sources/javascript/functional/ | |
//-- Imparative ------------------------------------------------------- | |
var getUserName = function(email) { |
#!/usr/bin/env ruby | |
tagname = ARGV.pop | |
def prompt(*args) | |
print(*args) | |
gets.chomp | |
end | |
if tagname.nil? |
<?xml version="1.0"?> | |
<root> | |
<item> | |
<name>Programmer's Shift Keys</name> | |
<!-- | |
Author: Carwin Young (@carwin) | |
Last Updated: 2013.02.10 | |
v.1.0 | |
Programmer's Shift Keys |
// Classic Javascript | |
function fib(n) { | |
if(n === 0) { return 0 } | |
if(n === 1) { return 1 } | |
return fib(n-1) + fib(n-2)} | |
// Non-auto-curry | |
const mkCases = // :: Object Functions -> a -> b | |
cases => key => | |
(cases[key]? cases[key] : cases["_"])(key) |
var | |
CHAR = '*', | |
NEWLINE = '\n', | |
repeat = | |
function repeat(c, n) { | |
if(n === 0) { return ''; } | |
return c + repeat(c, n-1); | |
}, | |
lines = |