Skip to content

Instantly share code, notes, and snippets.

View tutysara's full-sized avatar

tutysara tutysara

View GitHub Profile
tutysara / MerjSawt.clj
Created March 21, 2012 17:58 — forked from christianblunden/MerjSawt.clj
TCO optimised Clojure implementation of Merge Sort
(ns merge_sort.core
(:use [ :only (reader)])
(:gen-class :main true))
(defn merj [left right]
(loop [[lhead & ltail :as left] left
[rhead & rtail :as right] right
result []]
(cond (nil? left) (concat result right)
(nil? right) (concat result left)
tutysara /
Created July 12, 2012 17:33 — forked from lowstz/
A simple script to install JDE for Emacs (JDEE)
# Change `ELISP_DIR` variable as you needed
echo -n "This script require wget and unzip, please ensure that your system has been installed them?[yes/no]:"
read choice
case $choice in
tutysara / gist:3218266
Created July 31, 2012 16:29 — forked from swannodette/gist:3217582
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [grid x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in grid [x y])))
(defn init [grid [pos value]]
(defn tst []
(fn [aseq]
(let [mapfn (fn [v]
(let [v (identity v)
_ (println :x)
_ (println :y)]
(map mapfn aseq))))
curl ""|tail -n +6 |head -n -4|cut -d, -f2|sed 's/"//g' > USD.csv
curl ""|tail -n +6 |head -n -4|cut -d, -f2|sed 's/"//g' > EUR.csv
curl ""|tail -n +6 |head -n -
(def alldata (io/read-dataset
(def plot(-> (charts/xy-plot (range 180) (incanter/sel alldata :cols 0))
(charts/add-lines (range 180) (incanter/sel alldata :cols 1))
(charts/add-lines (range 180) (incanter/sel alldata :cols 2))
(charts/add-lines (range 180) (incanter/sel alldata :cols 3))
(charts/add-lines (range 180) (incanter/sel alldata :cols 4))
(charts/add-lines (range 180) (incanter/sel alldata :cols 5))
(charts/add-lines (range 180) (incanter/sel alldata :cols 6))
(incanter/view plot)
(defn normalize
"Normalizes data"
(let [mean (stats/mean dataseq)
normalfn (fn [x] (/ (- x mean) mean))]
(map normalfn dataseq)))
(def normalized-plot
(-> (charts/xy-plot (range 180) (normalize (incanter/sel alldata :cols 0)))
(charts/add-lines (range 180) (normalize (incanter/sel alldata :cols 1)))
(charts/add-lines (range 180) (normalize (incanter/sel alldata :cols 2)))
(charts/add-lines (range 180) (normalize (incanter/sel alldata :cols 3)))
(charts/add-lines (range 180) (normalize (incanter/sel alldata :cols 4)))
(charts/add-lines (range 180) (normalize (incanter/sel alldata :cols 5)))
(charts/add-lines (range 180) (normalize (incanter/sel alldata :cols 6)))
(def alldata (io/read-dataset "alldata.csv"))
(defn normalize
"Normalizes data"
(let [mean (stats/mean dataseq)
normalfn (fn [x] (/ (- x mean) mean))]
(map normalfn dataseq)))
(def plot(-> (charts/xy-plot (range 180) (incanter/sel alldata :cols 0))