datomic / day-of-datomic Goto Github PK
View Code? Open in Web Editor NEWSample Code for Day of Datomic presentation
Sample Code for Day of Datomic presentation
I get this message when running lein trampoline repl in windows
Exception in thread "main" clojure.lang.LispReader$ReaderException: java.lang.Ru
ntimeException: Unsupported escape character: \p
at clojure.lang.LispReader.read(LispReader.java:220)
at clojure.core$read.invoke(core.clj:3407)
at clojure.core$read.invoke(core.clj:3405)
at clojure.main$eval_opt$fn__6602.invoke(main.clj:306)
at clojure.main$eval_opt.invoke(main.clj:306)
at clojure.main$initialize.invoke(main.clj:327)
at clojure.main$null_opt.invoke(main.clj:362)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: Unsupported escape character: \p
at clojure.lang.Util.runtimeException(Util.java:219)
at clojure.lang.LispReader$StringReader.invoke(LispReader.java:505)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1148)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:982)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1148)
at clojure.lang.LispReader$MapReader.invoke(LispReader.java:1091)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1148)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:982)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1148)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:982)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1148)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:982)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1148)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:982)
at clojure.lang.LispReader.read(LispReader.java:185)
... 12 more
Error reads: Could not start nREPL server: Could not find artifact org.clojure:clojure:jar:1.9.0-rc2 in central (https://repo1.maven.org/maven2/)
Could not find artifact org.clojure:clojure:jar:1.9.0-rc2 in clojars (https://repo.clojars.org/)
location is :dependencies [[org.clojure/clojure "1.9.0-RC2"]
Fixed case to RC2 and it worked fine https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-RC2/
When using lein 2.0.0-preview8 on social_news.clj:
$ lein repl
user=> (use :reload 'datomic.samples.repl)
nil
user=> (easy!)
:awesome
user=> (def conn (scratch-conn))
#'user/conn
user=> (defpp change-user-name-result
#_=> "Demonstrates upsert. Tempid will resolve to existing id to
#_=> match specified :user/email."
#_=> (d/transact
#_=> conn
#_=> [{:user/email "[email protected]" ;; this finds the existing entity
#_=> :db/id #db/id [:db.part/user] ;; will be replaced by existing id
#<RuntimeException java.lang.RuntimeException: No reader function for tag db/id>
The same happens for other tutorials that have reader functions.
I found this explanation which pointed me to use lein trampoline repl
which does work with lein 2.0.0-preview10. We should update the docs to use trampoline, explain lein repl's limitations or explain which versions work for lein repl.
Basically #22 but "no pull requests"
I just cloned the latest code from github (commit a60b703, Mon Jul 1 2013). Running lein repl
or lein trampoline repl
. Gave me the below error. It looks like one of the dependant libraries, nrepl-inspect, is using an older version of tools.namespace (0.2.3).
webkell@ubuntu:~/Projects/trial/day-of-datomic$ lein trampoline repl
:repositories detected in user-level profiles! [:user]
See https://github.com/technomancy/leiningen/wiki/Repeatability
Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/tools/namespace/find__init.class or clojure/tools/namespace/find.clj on classpath:
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
In the Day-Of-Datomic project configuration, I put in the latest ([org.clojure/tools.namespace "0.2.4"]
), and the repl now comes up. I'd make a pull request, but the problem seems to be in a dependent library. So ideally, the change would be made there. But Let me know if you'd like me to fix and make a pull request.
Hth
In the REST API, I've transacted the "Hello World" datom as in hello_world.clj. If I then navigate to /api/query and put in the query
[:find ?e :where [?e :db/doc "Hello world"]]
I get a single result back. But if I add the "dot" for a single scalar binding, as is done on line 29 of hello_world.clj:
[:find ?e . :where [?e :db/doc "Hello world"]]
I get a 500 error from the server. I thought it might be an issue with URL-encoding--the "." stays as a dot rather than going to %2E--but changing that doesn't make a difference. I'm running Datomic 0.9.5344; I imagine this isn't an issue with the tutorial but thought I'd report it here first in case this is a "newbie issue." It's not entirely clear to me from the documentation what the single dot binding achieves.
Looks like the namespace 'clojure.repl' should be required explicitly in social_news.clj file or evaluate (easy!) macro beofre any functions from clojure.repl ns are used.
easy! macro is the one doing the requiring for clojure.repl ns (I am not really familiar with macros but we are doing (use 'datomic.samples.repl). clojure.repl should be loaded when (easy!) is called and not otherwise?)
; CIDER 0.7.0snapshot (package: 20140730.148) (Java 1.7.0_60, Clojure 1.6.0, nREPL 0.2.3, cider-nrepl 0.7.0-snapshot)
user> (use 'datomic.samples.repl)
nil
user> (doc easy!)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: doc in this context, compiling:(/private/var/folders/0f/4w3qyc8s5vs9bnv6lfh5pg_80000gn/T/form-init7212022613257498497.clj:1:1)
user> (easy!)
:awesome
user> (doc easy!)
datomic.samples.repl/easy!
([])
Macro
Set up a bunch of REPL conveniences. See the source
with (source easy!) for details.
nil
user>
misplaced close-bracket in schema.edn in initial "stories" section
user=> (load-file "tutorial/migration.clj")
true
user=> (has-attribute? (d/db conn) :story/title)
true
user=> (has-attribute? (d/db conn) :story/slug)
true
user=> (has-attribute? (d/db conn) :comment/author)
false
user=>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.