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 Nurullah Akkaya's gist at http://gist.github.com/399127 | |
(ns scraper | |
(:use [clojure.contrib.duck-streams :only [spit]] | |
[clojure.contrib.seq-utils :only [partition-all]]) | |
(:import (java.net URL) | |
(java.io BufferedReader InputStreamReader FileReader) | |
java.util.Date java.text.SimpleDateFormat)) | |
(defn scrape [url] | |
(try |
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
(ns | |
#^{:author "Eric Schulte", | |
:license "GPLV3", | |
:doc "Simple concurrent propagator system."} | |
propagator | |
(:use clojure.contrib.repl-utils clojure.contrib.math)) | |
(defmacro cell "Define a new cell." | |
[name state] | |
`(def ~name (agent ~state))) |
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
(in-ns 'propagator) | |
(cell guess 1) | |
(cell x 9) | |
(cell done false) | |
(cell margin 0.1) | |
(propagator enough [x guess] [done] | |
(Thread/sleep 1000) | |
(if (< (abs (- (* guess guess) x)) @margin) true false)) |
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
;;; Code: | |
(require 'ob) | |
(require 'comint) | |
(declare-function org-babel-get-src-block-info "ext:ob" (&optional hvo)) |
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
(html | |
[:head [:title "Org-server"]] | |
[:body | |
[:center | |
[:h2 "Org-server"] | |
[:p | |
"Generate pdf documents from existing templates or from new raw | |
Org-mode files."] | |
[:p | |
(form-to [:POST "/upload"] |
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
(defun org-babel-ref-index-list (index lis) | |
"Return the subset of LIS indexed by INDEX. | |
Indices are 0 based and negative indices count from the end of | |
LIS, so 0 references the first element of LIS and -1 references | |
the last. If INDEX is separated by \",\"s then each \"portion\" | |
is assumed to index into the next deepest nesting or dimension. | |
A valid \"portion\" can consist of either an integer index, two | |
integers separated by a \":\" in which case the entire range is |
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
(defn first-where | |
"Return the index in coll of the first place where f returns true." | |
[f coll] | |
(loop [ind 0 c coll] (if (f (nth c ind)) ind (recur (inc ind) coll)))) |
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
(define foo | |
(lambda (i) | |
(if (= i 0) | |
(lambda (x) x) | |
(lambda (x) (foo (- i 1)))))) |
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
(dorun | |
(take (to-int out-num) | |
(filter | |
#(= (:fitness %) (to-int test-num)) | |
(map | |
#(do (println (pr-str %)) %) | |
(let [cross (to-int cross) | |
cross (if (< cross 1) cross (/ cross 100))] | |
(pmap | |
#(evaluate-asm % script (to-int timeout)) |
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
(ns neural-net.core) ; Copyright Eric Schulte, GPL V3 | |
(defprotocol Neural | |
"Protocol implemented by any element of a neural network." | |
(run [this x] "Evaluates the net") | |
(train [this x y d] "Trains the net returning the updated net and deltas") | |
(collect [this key] "Collect key from the network") | |
(inputs [this] "Number of inputs") | |
(outputs [this] "Number of outputs") | |
(check [this] "Ensure that the number of inputs matches the outputs")) |