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
package xaresource; | |
import static org.hamcrest.CoreMatchers.is; | |
import static org.junit.Assert.assertThat; | |
import static org.junit.Assert.fail; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.nio.charset.StandardCharsets; |
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
package control.structures.continuations.quasarFiberChannelSameThread; | |
import java.io.Serializable; | |
import java.util.Iterator; | |
import java.util.NoSuchElementException; | |
import co.paralleluniverse.fibers.SuspendExecution; | |
import co.paralleluniverse.strands.Strand.State; | |
import co.paralleluniverse.strands.SuspendableCallable; |
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 min-cps [args ret] | |
(ret (apply min args))) | |
(defn plus-cps [args ret] | |
(ret (apply + args))) | |
(defn multiply-cps [args ret] | |
(ret (apply * args))) | |
(defn equals-cps [a b ret] | |
(ret (= a b))) | |
(defn toplevel-levenshtein-cps-memoize [x y] |
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
;;; implementation in clojure of the levenshtein allison algorithm as defined here: | |
;;; http://www.csse.monash.edu.au/~lloyd/tildeFP/Haskell/1998/Edit01/ | |
(defn min3 [w nw n] | |
(if (< w nw) w (min nw n))) | |
(defn generate-diagonale [a b nw fn-diag-above fn-diag-below start] | |
(if start | |
(lazy-cat (list nw) (generate-diagonale a b nw fn-diag-above fn-diag-below false)) | |
(if (or (empty? a) (empty? b)) '() |
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 mynamespace.dt | |
(:use clojure.set) | |
(:use [datomic.api :only [q db] :as d]) | |
(:use clojure.pprint) | |
) | |
;;; http://www.lshift.net/blog/2010/08/21/some-relational-algebra-with-datatypes-in-clojure-12 | |
(defrecord Supplier [number name status city]) |
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 datomic-group-fds-by-fd-id [fd-v & {:keys [id-fn] :or {id-fn :hash}}] | |
(q '[:find ?fd-id (into [] ?fd) | |
:in $fd-v | |
:where | |
[$fd-v ?fd ?fd-id] | |
] | |
(maps->rel fd-v [id-fn]))) | |
(defn datomic-get-redundant-files [grouped-fds-by-fd-id & {:keys [id-fn] :or {id-fn :hash}}] | |
(q '[:find ?fd-v-g |
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
;;; The solution relies on the following implementation of the partitions function: | |
;;; https://gist.github.com/ray1729/5830608 | |
(defn partition-combination-sets [partition] | |
(let [partition (vec partition) | |
c (count partition)] | |
(for [i (range 1 (inc c)) | |
combination (combinatorics/combinations (range c) i)] | |
;; the following (map partition combination) may be a bit confusing, because it does use the vector | |
;; defined above as a function and has nothing to do with the standard partition function of the clojure core language. |
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 experiment.incanter | |
(:require [incanter.core :as i])) | |
(def join-dataset-1 (i/dataset [:id :vehicle-type] | |
[[1 "car"] | |
[2 "motor-bike"] | |
[3 "train"]])) | |
;;;(i/view join-dataset-1) | |
(def join-dataset-2 (i/dataset [:id :number-wheels] |
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 numpy as np, pandas as pd, matplotlib.pyplot as plt, seaborn as sns | |
import scipy.stats as stats | |
from theano import tensor as tt | |
import pymc3 as pm | |
from pymc3.distributions.dist_math import bound, logpow, gammaln | |
from pymc3.distributions.distribution import draw_values, generate_samples | |
SEED = 5132290 # from random.org | |
np.random.seed(SEED) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer