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
(with-test | |
(defn prime-factors [n] | |
((fn this [n_ last-divisor] | |
(if (= n_ 1) | |
[] | |
(let [ | |
divisor | |
(or | |
(some | |
#(when (zero? (mod n_ %)) %) |
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
(use 'clojure.contrib.test-is) | |
(use 'clojure.contrib.trace) | |
(with-test | |
(defn prime-factorials [n] | |
(if (= n 1) | |
'() | |
(if-let [ | |
divisor | |
(some |
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
(use 'clojure.contrib.test-is) | |
(def now (new java.util.Date)) | |
(defn date [year month day] | |
(new java.util.Date (- year 1900) (dec month) day)) | |
(with-test | |
(defn business-method [date] | |
(let [after #(pos? (compare %1 %2))] |
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
; Refactor of http://www.fatvat.co.uk/2009/05/neural-networks-and-clojure.html | |
(defn create-network | |
[out] | |
(repeat out 0)) | |
(defn run-network | |
[input weights] | |
(if | |
(> (reduce + (map * input weights)) 0.001) |
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
7 December 2010 4:26:41 pm | |
VM: Win32 - Newspeak Virtual Machine 10.02.2201 | |
Image: nsboot-2010-02-22.00 [latest update: #0] | |
SecurityManager state: | |
Restricted: false | |
FileAccess: true | |
SocketAccess: true | |
Working Dir c:\Program Files\Newspeak Virtual Machine |
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
data Dollars = Dollars | |
data Euro = Euro | |
class Money a where | |
(+) :: (Int, a) -> (Int, a) -> Int | |
(+) (a, _) (b, _) = (Prelude.+) a b | |
instance Money Dollars | |
instance Money Euro |
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
// from http://mbostock.github.com/d3/ex/chord.html | |
var chord = d3.layout.chord() | |
.padding(0.05) | |
.sortSubgroups(d3.descending) | |
.matrix([ | |
[11975, 5871, 8916, 2868], | |
[ 1951, 10048, 2060, 6171], | |
[ 8010, 16145, 8090, 8045], | |
[ 1013, 990, 940, 6907] |
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
public final class io.halik.scala.Outer$delayedInit$body extends scala.runtime.AbstractFunction0 | |
minor version: 0 | |
major version: 50 | |
flags: ACC_PUBLIC, ACC_FINAL, ACC_SUPER | |
{ | |
private final io.halik.scala.Outer $outer; | |
descriptor: Lio/halik/scala/Outer; | |
flags: ACC_PRIVATE, ACC_FINAL | |
(...) |
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
const FastPriorityQueue = require("fastpriorityqueue"); | |
const setZeroTimeout = (callback: any) => { | |
const channel = new MessageChannel(); | |
channel.port1.onmessage = callback; | |
channel.port2.postMessage(""); | |
}; | |
const queue: any = new FastPriorityQueue( (a: any, b: any) => | |
a.data.priority > b.data.priority |
OlderNewer