This file contains hidden or 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 fixp? (lambda (f x) (equal? (f x) x))) | |
(define quine? (lambda (x) (fixp? eval x))) | |
(define apply1 (lambda (f) (lambda (x) (f x)))) | |
(define fac* | |
(lambda (f) | |
(lambda (n) | |
(if (< n 2) |
This file contains hidden or 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
U,s,V = np.linalg.svd(X, full_matrices=False) | |
n = X.shape[0] | |
k = n # or however many terms you want to keep | |
X_zca = np.sqrt(n) * U[:,:k].dot(V[:k]) |
This file contains hidden or 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
w = 96 | |
n = 20000 | |
l = 32 | |
def rand_ranges(a, b, l, size): | |
r = np.repeat(np.arange(l, dtype=np.intp)[np.newaxis], size, axis=0) | |
r += np.random.randint(a, b-l, size=size)[:,np.newaxis] | |
return r | |
si0 = np.random.randint(0, images.shape[0], size=n) |
This file contains hidden or 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
import Data.Map (Map) | |
import qualified Data.Map as Map | |
import Data.List (nub, maximumBy) | |
import Data.Function (on) | |
import Control.Concurrent | |
type Loc = (Int, Int) | |
size :: Int | |
size = 8 |
This file contains hidden or 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 cljs-spike.core) | |
(defn vector->react [v] | |
(let [[el attrs body] v | |
react-body (react body)] | |
(if (keyword? el) | |
(make-react-dom-component el attrs react-body) | |
(el attrs react-body)))) | |
(defn make-react-dom-component [el attrs react-body] |
This file contains hidden or 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
user> (cemerick.piggieback/cljs-repl :repl-env (nashorn/repl-env)) | |
Type `:cljs/quit` to stop the ClojureScript REPL | |
nil | |
cljs.user> (+ 1 1) | |
2 | |
cljs.user> (js/java.lang.System.currentTimeMillis) | |
1404733130652 |
This file contains hidden or 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
This came up in discussion with a couple of people | |
at the Melbourne Funtional Users Group | |
Problem: | |
Create a program that takes as input a list of languages, then outputs | |
a multi-quine that cycles through those languages in order. | |
e.g. |