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
(defproject fmspider "0.1.0" | |
:description "" | |
:url "http://example.com/FIXME" | |
:license {:name "Eclipse Public License" | |
:url "http://www.eclipse.org/legal/epl-v10.html"} | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[org.clojure/tools.namespace "0.2.4"] | |
[itsy "0.1.1"] | |
[clj-http "0.9.1"] | |
[enlive "1.1.5"] |
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
function first(xs) { | |
return xs[0]; | |
}; | |
function rest(xs) { | |
if (xs.length <= 0) { | |
return []; | |
} | |
return xs.slice(1, xs.length); | |
}; |
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
var each = function(list, f) { | |
for (var i = 0; i < list.length; i++) { | |
f(list[i]); | |
} | |
}; | |
var map = function(list, f) { | |
var arr = []; | |
for (var i = 0; i < list.length; i++) { | |
arr.push(f(list[i])); |
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
var makeStopwatch = function() { | |
var elapsed = 0; | |
var interval; | |
var stopwatch = function(){ | |
return elapsed; | |
}; | |
var increase = function() { elapsed++; }; |
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 class="no-js" lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<title>Telegraph Prep Week 2</title> | |
<meta name="description" content="JavaScript Fundamentals: Objects, Arrays and Functions"> | |
</head> | |
<body> | |
<div> | |
<h2> This Page is intentionally left blank. Please open the javascript console in your developer tools</p> |
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
function each(array, f) { | |
for(var i = 0; i < array.length; i++) { | |
f(array[i]); | |
} | |
} | |
function map(array, f) { | |
var acc = []; | |
each(array, function(x) { | |
acc.push(f(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
function longerThan(word1, word2) { | |
if (word2.length > word1.length) { | |
return word2; | |
} else { | |
return word1; | |
} | |
} | |
function reduce(array, f, acc) { | |
var start = acc; |
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
var makeStopwatch = function() { | |
var elapsed = 0; | |
var intervalId; | |
var increase = function() { elapsed++; }; | |
var stopInterval = function() { | |
clearInterval(intervalId); | |
}; |
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
// 1. Compute the sum of squares up to `n`, where n is 10. | |
var n = 10; | |
var i = 0; | |
var result = 0; | |
while (i < n) { | |
result = result + (i * i); | |
i++; | |
} | |
console.log(result); |
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
:: Conway's game of life: http://urbit.org/docs/hoon/exercises/life/ | |
:: Solution up to prompt 7. | |
!: | |
:: | |
=< |= times/@ | |
(life times) | |
:: | |
=> |% | |
++ spot {r/@ c/@} | |
++ row (list ?) |
OlderNewer