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
;; Datomic example code | |
;; demonstrates various update scenarios, using a news database | |
;; that contains stories, users, and upvotes | |
;; grab an in memory database | |
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://foo") | |
(d/create-database uri) | |
(def conn (d/connect uri)) |
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 '[datomic.api :only [db q] :as d]) | |
;; DB setup | |
(def schema | |
[{:db/id #db/id[:db.part/db] | |
:db/ident :site/url | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one | |
:db.install/_attribute :db.part/db} | |
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
(def uri "datomic:mem://testdb") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; The schema | |
(def s [{:db/id #db/id[:db.part/db] | |
:db/ident :testdb/test | |
:db/valueType :db.type/boolean | |
:db/cardinality :db.cardinality/one |
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 segmento [left middle right all] | |
(fresh [xs] | |
(appendo left middle xs) | |
(appendo xs right all))) | |
user> (run* [q] | |
(segmento [1 2] [3 4] [5 6] [1 2 3 4 5 6])) | |
(_.0) |
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 termite.core | |
(:refer-clojure :exclude [==]) | |
(:use [clojure.core.logic])) | |
(def inc-rule | |
(let [x (lvar)] | |
[#(all (== % `(~'+ ~x 1)) | |
;; It's easy to add pattern predicates | |
(pred x number?)) | |
#(== % `(inc ~x))])) |
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
From 22694b6e3d0ae4fe9c649deead0127073bf3c7c9 Mon Sep 17 00:00:00 2001 | |
From: Jonas Enlund <[email protected]> | |
Date: Sun, 5 Feb 2012 18:09:07 +0200 | |
Subject: [PATCH] Skeleton app | |
--- | |
project.clj | 2 +- | |
public/design.html | 4 - | |
src/app/clj/newapp/config.clj | 27 +++++ | |
src/app/clj/newapp/dev_server.clj | 67 ++++++++++++ |
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
$ script/cljs-repl | |
ClojureScript:cljs.user> (in-ns 'one-sample-model) | |
ClojureScript:one-sample-model> state | |
"Error evaluating:" state :as ".state;\n" | |
#<SyntaxError: Unexpected token .> | |
SyntaxError: Unexpected token . | |
at http://localhost:8080/javascripts/out/clojure/browser/repl.js:21:158 | |
at evaluate_javascript (http://localhost:8080/javascripts/out/clojure/browser/repl.js:33:3) | |
at Object.callback (http://localhost:8080/javascripts/out/clojure/browser/repl.js:115:126) | |
at [object Object].deliver (http://localhost:8080/javascripts/out/goog/messaging/abstractchannel.js:141:13) |
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
No message. | |
[Thrown class java.lang.NullPointerException] | |
Restarts: | |
0: [QUIT] Quit to the SLIME top level | |
Backtrace: | |
0: clojure.lang.Compiler.lookupVar(Compiler.java:6780) | |
1: clojure.lang.Compiler.isInline(Compiler.java:6277) | |
2: clojure.lang.Compiler.analyzeSeq(Compiler.java:6402) |
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 csvtest.core | |
(:require [clojure.java.io :as io] | |
[clojure.data.csv] | |
[clojure-csv.core])) | |
(def characters | |
(vec | |
(concat "0123456789" | |
"abcdefghijklmnopqrstuvxyz" | |
"ABCDEFGHIJKLMNOPQRSTUVXYZ" |
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
; src/bar.clj | |
(ns bar) | |
(defmacro bar-macro [x] | |
`(inc ~x)) |