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
(require '[incanter.core :as in] | |
'[incanter.stats :as st] | |
'[incanter.charts :as ch]) | |
(defn generate-sample-cluster [x y sd n] | |
(let [generate-by #(st/sample-normal n :mean (+ % (rand 2)) :sd sd)] | |
(map vector (generate-by x) (generate-by y)))) | |
(defn plot-clusters-with-function [f [fcluster & rclusters :as clusters]] | |
(let [init-plot (ch/scatter-plot (map first fcluster) (map second fcluster)) |
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.core.match :only (match)] | |
'[clojure.math.numeric-tower :as math]) | |
;;--------------------------------------------------------------- | |
;; profiler | |
(def profiling-points (ref {})) | |
(def temp-value (ref [])) | |
(def profile-program true) | |
(defmacro prof [dist-name s-exp] |
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
;; a simple meta-circular interpreter | |
;; shift/reset (delimited continuation) implemented | |
(use util.match) | |
(define lookup | |
(lambda (var env exception) | |
(cond | |
((null? env) | |
(exception (string-append | |
"# error :: could not find the variable > " |
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
;; a simple meta-circular interpreter | |
;; curried version | |
(use util.match) | |
(define lookup | |
(lambda (var env exception) | |
(cond | |
((null? env) | |
(exception (string-append | |
"# error :: could not find the variable > " |
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
;; a simple meta-circular interpreter | |
(use util.match) | |
(define lookup | |
(lambda (var env exception) | |
(cond | |
((null? env) | |
(exception (string-append | |
"# error :: could not find the variable > " | |
(symbol->string var)))) |
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
import java.nio.file.*; | |
public class FileRead { | |
public static void main(String args[]) throws Exception{ | |
System.out.println(new String(Files.readAllBytes(Paths.get("src/short.txt")), "UTF-8")); | |
} | |
} |
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
(require 'generic-x) | |
(defun list-interleave (ls res inserting) | |
(cond | |
((not ls) (reverse res)) | |
((not res) (list-interleave (cdr ls) (cons (car ls) res) inserting)) | |
(t (list-interleave | |
(cdr ls) | |
(cons (car ls) (cons inserting res)) | |
inserting)))) |