Suppose we have a business with only 4 customers and 2 products. The customer can either view or buy a product. We can represent our customers and products as a graph like so.
CREATE
(bob { name:'Bob' }),
(tom { name:'Tom' }),
(def articles | |
[{:title "3 Langs" :author "boris" :tags #{:java :clojure :haskell}} | |
{:title "mylangs" :author "rocky" :tags #{:ruby :clojure :haskell}} | |
{:title "2 Langs" :author "boris" :tags #{:java :haskell}}]) |
FROM clojure | |
ADD . /usr/src/app | |
WORKDIR /usr/src/app | |
RUN lein deps |
package main | |
import ( | |
"fmt" | |
) | |
type rectPointer struct { | |
width int | |
height int | |
} |
;; https://scott.mn/2014/01/26/first_thoughts_on_liberator_clojure/ | |
(defn blog-post-resource [request id] | |
{:authorized? | |
(fnk [logged-in-user request] | |
(or logged-in-user | |
(= (:method request) :get))) | |
:allowed? | |
(fnk [logged-in-user author request] |
(defproject something "0.0.1" | |
:dependencies [[org.clojure/core.typed.core "0.x"]] ;; with minimal trace | |
:profiles {:dev {:dependencies [[org.clojure/core.typed "0.x"]]}}) ;; with full |
'use strict'; | |
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %> | |
var gulp = require('gulp'); | |
var open = require('open'); | |
var wiredep = require('wiredep').stream; | |
// Load plugins | |
var $ = require('gulp-load-plugins')(); |
(ns etl.field | |
"Cascalog field name and variable functions." | |
(:refer-clojure :exclude (replace)) | |
(:use [clojure.string :only (replace)])) | |
(defn replace-field [coll match replacement] | |
(let [idx (.indexOf coll match)] | |
(assoc coll idx replacement))) | |
(defn- agg-replace [suffix] |
;; TEST | |
(deftest join-right-recent-test | |
(let [left (memory-source-tap ["?timestamp" "?uscc" "?x"] | |
[[1000 "u1" "AAA"] | |
[2000 "u2" "BBB"]]) | |
right (memory-source-tap ["?timestamp" "?uscc" "?y" "?z"] | |
[[500 "u1" "a1" "a2"] | |
[800 "u1" "b1" "b2"] | |
[1100 "u1" "c1" "c2"]])] |
test.flips <- function(N, A.prop=0.5, B.prop=0.5, attr="p.value") { | |
heads.A <- rbinom(1, N, A.prop) | |
heads.B <- rbinom(1, N, B.prop) | |
test <- prop.test(c(heads.A, heads.B), n=c(N, N), alternative="two.sided") | |
return(as.numeric(test[attr])) | |
} | |
## vary number of flips | |
N <- seq(1, 1001, by=10) |