hello, does datascript somehow allow you to “subscribe” to queries? or somehow get notified to changes of part of the db?
@stathissideris Right now, the best solution to this is still https://github.com/mpdairy/posh, though I'll warn you that it is not perfect about guessing when it needs to update query results, in particular if you have things like recursive queries.
That's assuming you're looking for client side support. There's also a re-posh
plugin somewhere if you're using re-frame.
If you're looking for server side support for this kind of thing, you might want to take a look at https://github.com/sixthnormal/clj-3df.
Thanks! I was actually planning to use it with Java Swing
Cool! There was an effort some while back getting things to work clojure side, which is a little tricky cause there's no reagent. I don't remember/know what came of that, but maybe someone else can chime in.
Either way, may be worth checking out 3df as well, though I'll caution you that it doesn't cover all of datomic/datascript either. The underpinnings are in Rust, so naturally you can't use clj(s) functions for queries. Also, I think there are some kinds of queries it can't do perfectly (yet).
Ok thanks, I’ll give it a go
Cool! Excited to hear how that works for you.
I think if I can get the changes fro the transaction I might be fine with writing code that explicitly updates my swing gui
I really don’t want to invent react on swing
It’s too big a yak to shave 😄
Yeah, kind of depends on your update model, right? Like, if this is just a desktop app, probably fine just to recompute all queries on every tx. But if it's got multiple users or lots of changes, something like posh or 3df may help.
I did a thing with datomic and cljfx once upon a time, but I don't remember how I managed the update logic. Can potentially find some time next week to look back at that if you're interested.
It’s desktop, I’m writing a Clojure-based spreadsheet
Thanks, but cljfx is already react-like so I’m not sure how applicable it would be in my case
Sure
Any reason you're bound to swing over javafx? 🙂
Clojure based spreadsheet, huh? Sounds cool 🙂
Interested in hearing what you're vision is there if you're able to share at this point.
FWIW, I recently started using a super simple spreadsheet app called tad (https://www.tadviewer.com/). It's much lighter weight than excel or libreoffice calc, and I've found it pretty helpful for quick skimming csv files and such. It's not a full spreadsheet app though (though has some interesting tricks up its sleave, like sorting and pivots). Curious to hear where on the spectrum you're aiming for. I'd love to have a full spreadsheet model, where clojure-based cell formulas 🙂
I think I may have seen tad before, it’s mainly for pivots, right?
I tried javafx and it was too buggy and heavy for my tastes, and also i like the fact that swing you have no extra deps
Yeah, it (tad) doesn't have a lot of bells and whistles; Focus is on simplicity. But it's "tight" package and great for quickly scanning through files.
In terms of vision: it’s going to have Clojure as its primary scripting language, I’ll also try to make it as keyboard driven as possible. Will allow you to load deps and use them in the cells, so it should work with existing code relatively easily. Not sure about that yet, but I think it’s going to be a commercial app
Not sure if there is a market
Here’s an early demo from a while ago https://youtu.be/dd0yBua-o18
Very cool 🙂
Do you have a target price point yet?
No idea, I’ve never sold software as a product before
https://www.youtube.com/watch?v=3Yd3lQVbkYc&ab_channel=DanielJayRobinson
I’ve mainly released open source and that’s easy to “sell” 😊
Is the video meant to be joke? :thinking_face:
Yes
Like: "Look at us, selling software."
Oh! 😀 Have you ever sold any software you made?
As a service, yes; Never a desktop app.
Desktop is weird these days
I think there may be a market in finance for what I’m building
I'd consider it
🎉
Great to hear, now all that remains is to build it 😀
@stathissideris, not sure if you would consider something a little experimental, but if you're trying to build for desktop with something that's not swing and is not javafx, you can try https://github.com/phronmophobic/membrane. the graphics and event model is pure clojure
@smith.adriane oh I think I’ve seen this before and I do like the idea of skipping all the legacy that sits awkwardly in the middle of my app, but it looks like it would slow me down at this stage because I’d have to reimplement tables in membrane which is a large undertaking
I tried implementing a Clojure data structure inspector by drawing directly onto a canvas and it was way more effort than I had imagined
it would definitely slow you down in the short term. it depends on how much flexibility you would like to have with your UI in the long run. my experience is that once you start trying to do things that aren't built in with swing/cljfx, then it gets really hair really quickly.
What’s your motivation for this?
Yes, you’re right and I’ve ran into this sort of thing in the past
the short story is that I wanted all the cool react/re-frame/etc stuff available in the browser/cljs world, but I wanted to build a desktop app.
And did you? (Build the app)
Like what? I’m curious
here's some examples of one-off apps I built: • internal tool for transferring client's data • tool to quickly crop photos • ui for searching an old mbox file of customer support emails • I built a hobby project that could take a recording of someone playing every note on an instrument and then clip the notes to play any midi file using those clips. I made a simple ui to help detect the pitch of each note as well as automatically clip it • ui for keeping track of stuff for a board game I used to play with friends before the pandemic (gloomhaven) • https://github.com/phronmophobic/treemap-clj and the corresponding https://blog.phronemophobic.com/treemap/treemaps-are-awesome.html • some one-off charts
just saw one of your projects on reddit that I've used before, https://www.reddit.com/r/Clojure/comments/ils0kg/stathissiderisspecprovider/
very cool project
Thanks for the list, it sounds like you’ve done quite a few things with it!
Glad you like spec-provider 😊
I was actually wanting to build a spreadsheet-like app, but wanted access to the file system, better networking options, multi-processing, etc. which is nicer on the jvm compared to browser/node environments
FWIW, I'll be probably 2x more likely to buy it if I can use Oz/Vega for vizs 🙂
I’m only asking because yak shaving sometimes depletes my energy to the point of not wanting to do the original thing anymore
I've been having a lot of fun improving the membrane
Some would say that you’re stuck in the membrane :rolling_on_the_floor_laughing:
I've been building lots of one-off apps
Have you implemented scrolling in membrane yet?
I have
Oh yeah it’s in the demo
although, I have an irrational disdain for scrollviews, so I don't use them very often and support could probably be improved
That’s where I gave up
Text boxes couldn’t have been easy
it's not too bad. I recently found https://github.com/mogenslund/liquid, which I'm trying to make better use of
liquid has its own renderer(s), but the model is very flexible and you can easily integrate it with your own graphics model
membrane looks very interesting, I think I’ll devote some time to study your code
I've been using it for my own projects, but there are still some rough bits. don't hesitate to ping me or ask questions in #membrane
Vega is definitely going to be part of this
Thanks!