Skip to content

Instantly share code, notes, and snippets.

function fib_recursive(n) {
if (n <= 1)
return n;
return fib_recursive(n - 1) + fib_recursive(n - 2);
}
var fib = new Object();
fib.recursive = function(n) {
if (n <= 1)
var minimum_number_of_stamps = function() {
var memo = [];
var min_stamps = function(postage, stamps) {
if (postage == 0) {
return 0;
} else if (memo[postage]) {
return memo[postage];
} else {
var min = postage;
for (i = 0; i < stamps.length; i++) {
var algo = {
set_fib: function(fib) { this.fib = fib; },
call_fib: function(n) {
return this.fib.recursive(n);
}
};
var try_it = function(exception_logger) {
try {
fib_recursive(-1);
} catch(e) {
exception_logger.log(e.name, e.message);
}
}
function fib_recursive(n) {
if (n < 0) {
-- Map
increment x = x + 1
map increment [1, 2, 3, 4]
-- Map with curry
map (+1) [1, 2, 3, 4]
-- Map with lambda
map (\x = x + 1) [1, 2, 3, 4]
increment [] = []
increment (x:xs) = if x < 3 then [] else (x+1):increment xs
module Board.Mark
( o
, x
) where
o = "O"
x = "X"
module Main where
import Board.Mark
module Main where
import qualified Board.Mark
module Main where
import Board.Mark hiding (x)
x = 5