

"Hello World"
1337 :hello:bob
; A list of numbers(1,2,3,4,5); A list of strings("hello" "world"); A list of 'stuff'(1, "hello", {}, :bob)
; A vector of numbers[1,2,3,4,5,6,7]; A vector of strings ["hello", "world"]; A vector of 'stuff'[1, "hello", {}, :bob]
{
:name "Rob Ashton"
:age 1337
:beard :awesome
}
(def foo 5) (fn [] "hello) (def foo (fn [] "hello")); Call 'foo' (foo)
(defn foo [] "hello"); Call 'foo' (foo)
(defn next-world-state [world]
; Code goes here
)(defn starves? [is-alive, live-neighbours]
(and (< live-neighbours 2) is-alive) (defn live-neighbours [cell])(defn is-alive? [cell]) (defn dies? [cell](or(starves? (is-alive? cell) (live-neighbours cell)(overcrowds?(is-alive? cell) (live-neighbours cell)))
{:path "/db":indexes [ {id: "2"name: "My index"pending: [{ id: "2"paths: [ "/"
(defproject cravendb "0.1.0-SNAPSHOT"
:description "A clojure-oriented document-oriented database"
:url "http://robashton.github.io/cravendb"
:min-lein-version "2.2.0"
:dependencies [[org.clojure/clojure "1.5.1"]
; etc] (ANY "/document/:id" [id]
(resource
:allowed-methods [:put :get :delete :head]
:etag (fn [ctx] (etag-from-metadata ctx))
:put! (fn [ctx] (db/put-document instance id (read-body ctx)))
:delete! (fn [_] (db/delete-document instance id))
:handle-ok (fn [_] (db/load-document instance id)))) (:import
(org.apache.lucene.analysis.standard StandardAnalyzer)
(org.apache.lucene.store FSDirectory RAMDirectory)
(org.apache.lucene.util Version)
(org.apache.lucene.index IndexWriterConfig IndexWriter DirectoryReader)
(org.apache.lucene.search IndexSearcher Sort SortField SortField$Type)
(org.apache.lucene.queryparser.classic QueryParser)
(org.apache.lucene.document Document Field Field$Store Field$Index
TextField IntField FloatField StringField))) ; Create a RAM directory called 'dir'
(def dir (RAMDirectory.))
; Create an index writer over that dir
(def writer (IndexWriter. dir))
; Create an index reader over that dir
(def reader (IndexReader. dir))
; Query that reader
(IndexQuery reader "*")(defn create-index [file]
(let [analyzer (StandardAnalyzer. Version/LUCENE_CURRENT)
directory (FSDirectory/open file)
config (IndexWriterConfig. Version/LUCENE_CURRENT analyzer) ]
(LuceneIndex. analyzer directory config))) (defn lucene-seq
([page] (lucene-seq page (:results page)))
([page src]
(cond
(empty? (:results page)) ()
(empty? src) (lucene-seq ((:next page)))
:else (cons (first src) (lazy-seq (lucene-seq page (rest src)))))))(let [handle (open-file "foo.txt")](map to-user (read-lines handle)))
(def results(let [handle (open-file "foo.txt")](map to-user (read-lines handle))))(println results) ; CRASH
; Atom called x with value of 1
(atom x 1)
(println x) ; Atom called 'x' value of 1
(println @x) ; 1
; Increase whatever is in x by '1'
(swap! x inc)
(defn event-loop [initial-state input]
(go
(loop [state initial-state]
(if-let [event (<! input)]
(recur (dispatch-event state))))
(go
(loop [state (initial-state engine)]
(if-let [{:keys [cmd data]} (<! command-channel)]
(do
(debug "handling index loop command" cmd)
(recur (case cmd
:schedule-indexing (main-indexing-process state)
:notify-finished-indexing (main-indexing-process-ended state)
:removed-index state ;; WUH OH
:new-index (add-chaser state data)
:chaser-finished (finish-chaser state data)
:storage-request (storage-request state data))))
(do
(debug "being asked to shut down")
(wait-for-main-indexing state)
(wait-for-chasers state)
(close-open-indexes state)))))) handle_info(schedule_indexing, State) ->
handle_info(finished_indexing, State ->
handle_info(removed_index, State) ->