Skip to content

Instantly share code, notes, and snippets.

module Main where
import Board.Mark (x, y)
module Main where
import Board.Mark as Mark
-- Declare a module
module Game.Logic where
{- content -}
-- Declare a module and specify functions to export
module Game.Logic
( isOver
, isValid
, hasWon
) where
{- content -}
var fib = function(n) {
if (n <= 1) {
return n;
} else {
return fib_tail_recursive(n, 0, 1);
}
}
var fib_tail_recursive = function(n, a, b) {
if (n === 0) {
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 (var i = 0; i < stamps.length; i++) {
var postage = 32;
var stamps = [90, 30, 24, 15, 12, 10, 5, 3, 2, 1];
minimum_number_of_stamps(postage, stamps); // 2
function reverse_words_in_sentence() {
for (i = arguments.length - 1; i > -1; i--) {
this.push(arguments[i]);
}
return this.join(" ");
}
sentence = "The Good, the Bad and the Ugly".split(" ");
reverse_words_in_sentence.apply([], sentence);
// "Ugly the and Bad the Good, The"
String.prototype.reverse_words_in_sentence = function() {
return this.split(" ").reverse().join(" ");
}
String.prototype.reverse = makeReverseFunction();
function makeReverseFunction() {
function reverse() {
var string_array = this.split("");
var length = this.length;
var swap = function(a, b) {
temp = string_array[a];
string_array[a] = string_array[b];
string_array[b] = temp;