Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 20 10:56
    tonsky commented #432
  • May 20 10:56

    tonsky on master

    Mention externs for shadow-cljs… (compare)

  • May 19 22:01
    macklinhrw closed #432
  • May 19 22:01
    macklinhrw commented #432
  • May 19 21:10
    tonsky commented #432
  • May 19 16:21
    macklinhrw edited #432
  • May 19 16:19
    macklinhrw edited #432
  • May 19 16:08
    macklinhrw edited #432
  • May 19 16:07
    macklinhrw opened #432
  • May 14 17:19
  • May 11 02:50
  • May 10 17:12
    tonsky commented #52
  • May 10 16:36
    jleonard-r7 commented #52
  • May 10 16:36
    augustl commented #52
  • May 10 16:33
    jleonard-r7 commented #52
  • May 10 05:45
    metasoarous commented #52
  • May 10 03:24
    jleonard-r7 commented #52
  • May 09 23:49
    jleonard-r7 commented #52
  • May 09 23:49
    jleonard-r7 commented #52
  • May 09 23:49
    jleonard-r7 commented #52
Christopher Small
@metasoarous
Cheers! Thank you!
Brian Marco
@bamarco
@tonsky @metasoarous @alexandergunnarson I added a pr for tx-middleware tonsky/datascript#234 which would help address some of these schema issues, but i think would allow some flexibility for solving some other open problems in datascript that have performance trade offs. If you think this is a good direction @tonsky there is still some more polish to be done here.
Aron Gabor
@ashnur
do we have a visual editor for datascript? :)
i know there were talks about it, but i don't know what come of those...
Nikita Prokopov
@tonsky
@ashnur none that I know of
Christopher Small
@metasoarous
Hi @tonsky. Would you mind having a look at the PR @bamarco linked to above? It would be helpful for us to have a litmus as to whether this middleware idea is something you'd consider or not. We'd love to see it in datascript if you and others see value in it, and don't mind biding time for it to be fully vetted. But if you're disinclined, we'd like to get the ball rolling on figuring out how we work this into datsync/datsys.
Nikita Prokopov
@tonsky
THIS CHANNEL IS CLOSED IN FAVOUR OF SLACK. Grab invite here http://clojurians.net/, join https://clojurians.slack.com, look for #datascript channel. PLEASE DON’T ASK QUESTIONS HERE.
matrixbot
@matrixbot
bendlas 33333333333333`
Dave Orme
@coconutpalm
bummer
Jack Park
@KnowledgeGarden
Wow! It's late 2021 and someone (moi) is busy hacking around with datascript. Playing with the datascript tutorial found at https://github.com/kristianmandrup/datascript-tutorial/blob/master/datascript_getting_started.md for the clojure demo, using the latest datascript. The system creates a connection, then properly populates the database, but the query returns nothing. That's confusing; the API call to d/q seems correct; there is a populated connection, but no response. What might I be missing? Thanks in advance.
Brian Marco
@bamarco
Try a very simple query like (d/q ‘[:find ?attr :where [_ ?attr]] db)
Jack Park
@KnowledgeGarden
actually, the code uses conn, and that's usually referenced by @conn. Either way, that tiny query return nothing. When I substituted :name for underscore, it returned Nothing found for entity id :name. I'm rather new to this.
Brian Marco
@bamarco
db is a naming convention. @conn is usually held in a variable called db and db is used for functions that want the value of the database rather than the connection itself
Hie do you know the conn has data in it?
How*
Did you print it out in some way?
(prn @conn)
By the way a keyword like :name can’t go in the first position in a datascript datom
Brian Marco
@bamarco
`(d/q ‘[:find ?e ?attr ?value :where [?e ?attr ?value]] @conn) should show all the triples in the db
?e is the entity id. ?attr is the keyword attribute
Jack Park
@KnowledgeGarden
Something pathalogocal is going on: if I println the connection after populating with datoms, they are all in there; but (d/q ‘[:find ?e ?attr ?value :where [?e ?attr ?value]] @conn) still returns nothing, as if it never executed.
Brian Marco
@bamarco
See if pull and entity work. Pick an eid out of the printed datoms and test those 2 functions. Keeping in mind entity returns an object like thing with very little data do you will need something like (:attr (d/entity @conn eid)) to test it
Jack Park
@KnowledgeGarden
Wow! That was complex; I looked up datascript pull: https://cljdoc.org/d/datascript/datascript/1.2.8/api/datascript.core#pull and settled on this:
(d/pull @conn '[:db/id, :name] 1) which is working from data that looks like this:
:datoms [[1 :age 30 536870913] [1 :name Bob 536870913] [2 :age 15 536870913] [2 :name Sally 536870913]]}}]
and still get nothing. Even using 536870913 instead of 1 returned nothing. I'll make a gist of this code and link to it.
Brian Marco
@bamarco
Yeah, that’s weird. Maybe its some kind of environment bug. I’ll take a look at the gist when I get a chance
Jack Park
@KnowledgeGarden
I am on an M1 Mac which does raise some issues, using jdk 15, which creates other problems, but those issues did not show up in this work. They do show up in other code I'm running.
Jack Park
@KnowledgeGarden
I gave the entities new db/id values. This query (d/entity @conn 99) should return (:db/id 99) but returns nothing, not even nil. It's as if something is blocking the query APIs even though transactions appear to be working.
From another experiment that's not going well, I get this message, which does not give decent google:
"WARNING: requiring-resolve already refers to: #'clojure.core/requiring-resolve in namespace: datomic.common, being replaced by: #'datomic.common/requiring-resolve"
I have no clue where to start; this is an experiment in a simple memory db test using datomic-free
Jack Park
@KnowledgeGarden
Here is a possible hint: I hand entered the require, and some definitions into repl. Then, when I run d/entity and d/pull, they run fine.
datascript-test.core=> (d/pull @conn '[:db/id, :name] 99)
{:db/id 99, :name "Bob"}
Why repl, but not in a main function? The function itself appears to run because it executes some printlns.
Brian Marco
@bamarco
that WARNING message is for datomic and not datascript (probably datomic version is older than clojure version)
datascript doesn't use datomic as a dependency
try removing datomic from your project.clj if you are using lein, or from your deps.edn if you are using the clojure command line tools
it may be that the repl doesn't load datomic and causes no problems. this behavior is very strange
maybe make a project that just has the datascript bits and nothing else
Brian Marco
@bamarco
those type of WARNINGS cropped up all the time when spec was being rolled out. that looks like a piece of code that was moved into clojure core from datomic
main is intricately tied to the java runtime so that may also be where the issue lies in a difference between the repl and main. as a wild idea you could try putting genclass in your namespace to get the main function to work properly if you haven't done that (I rarely use main)
Jack Park
@KnowledgeGarden
Indeed, that was not the datascript project, but a predecessor where I simply tried the datomic jar, which is quite dated and not updated. I am abandoning that project. Continuing to experiment with the datascript code.
Brian Marco
@bamarco
I've got a project working at the moment that uses datascript/datascript {:mvn/version "1.0.0"} and org.clojure/clojure {:mvn/version "1.10.1"} so I know those versions are compatible
my actual version of clojure is Clojure CLI version 1.10.3.855
openjdk version "1.8.0_161" OpenJDK Runtime Environment (IcedTea 3.7.0)
line 36 in your jist has a really high number which looks like a datascript timestamp and not an eid
gist*
Brian Marco
@bamarco
(d/datoms @conn :eavt) is another way to get at datoms. maybe will give more insight into what is broken
Jack Park
@KnowledgeGarden
When placed inside the main function, that was unresponsive. I have not loaded repl to try that. What puzzles me is how unresponsive queries are inside the main function. That function proves it is called.
Brian Marco
@bamarco
Are you printing the results?
Jack Park
@KnowledgeGarden
Hah! I had shut down, then realized I'm not printing them inside a function. Added printlns and it's all working just fine. My bad. Thank you!
Brian Marco
@bamarco
I only knew to ask because I’ve done it myself :)
Christopher Small
@metasoarous
LOL; This is gold. Just read down through this to see that the problem was a missing println. We've all been there.
BTW @KnowledgeGarden; You may get more active responses over at the Clojurians Slack chat, in the #datascript channel.
Jack Park
@KnowledgeGarden
Thanks! I'll look into that. But, I got fantastic responses right here :-)