If you don't have homebrew installed - get homebrew here
Then run: brew install elasticsearch
Update the elasticsearch configuration file in /usr/local/etc/elasticsearch/elasticsearch.yml.
| ;; fixed version of 'state' at http://mishadoff.com/blog/clojure-design-patterns/#episode-3-state | |
| ;; takeaway: if you call 'swap!' twice on the same atom, you are probably making a mistake | |
| (def user {:name "Jackie Brown" | |
| :balance 0 | |
| :subscription? false}) | |
| (def ^:const SUBSCRIPTION_COST 30) | |
| (defn pay |
| (ns powerset.core-test | |
| (:use (clojure set test))) | |
| (defn powerset [s] | |
| (apply union | |
| #{s} ;the complete set of all s | |
| (map (fn [i] (powerset (disj s i))) s))) | |
| (deftest test-powerset | |
| (is (= #{#{}} |
| (ns clj-spec-playground | |
| (:require [clojure.string :as str] | |
| [clojure.spec :as s] | |
| [clojure.test.check.generators :as gen])) | |
| ;;; examples of clojure.spec being used like a gradual/dependently typed system. | |
| (defn make-user | |
| "Create a map of inputs after splitting name." | |
| ([name email] |
If you don't have homebrew installed - get homebrew here
Then run: brew install elasticsearch
Update the elasticsearch configuration file in /usr/local/etc/elasticsearch/elasticsearch.yml.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| package pipe_foundations.example; | |
| import pipe_foundations.Pipe; | |
| import pipe_foundations.SimpleFilter; | |
| public class ExampleFilter extends SimpleFilter<Integer, String> { | |
| public ExampleFilter(Pipe<Integer> input, Pipe<String> output) { | |
| super(input, output); | |
| } |
| package java8tests ; | |
| import java.util.function.BiFunction ; | |
| import java.util.function.Function ; | |
| public class Currying { | |
| public void currying() { | |
| // Create a function that adds 2 integers | |
| BiFunction<Integer,Integer,Integer> adder = ( a, b ) -> a + b ; |
| (use 'clojure.core.async) | |
| (defprotocol ISendable | |
| (channel [this])) | |
| (defn async-agent [state] | |
| (let [c (chan Long/MAX_VALUE) ;; <<-- unbounded buffers are bad, but this matches agents | |
| a (atom state)] | |
| (go-loop [] | |
| (when-let [[f args] (<! c)] |
| def knapsack_aux(x: (Int, Int), is: List[Int]): List[Int] = { | |
| for { | |
| w <- is.zip(is.take(x._1) ::: is.take(is.size - x._1).map(_ + x._2)) | |
| } yield math.max(w._1, w._2) | |
| } | |
| def knapsack_rec(xs: List[(Int, Int)], is: List[Int]): List[List[Int]] = { | |
| xs match { | |
| case x :: xs => knapsack_aux(x, is) :: knapsack_rec(xs, knapsack_aux(x, is)) | |
| case _ => Nil |
| box: wercker/default | |
| services: | |
| - wercker/postgresql | |
| - wercker/rabbitmq | |
| - wercker/redis | |
| build: | |
| steps: | |
| - script: | |
| name: install clojure | |
| code: | |