datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
stathissideris 2020-09-04T20:00:27.043200Z

hello, does datascript somehow allow you to “subscribe” to queries? or somehow get notified to changes of part of the db?

2020-09-04T22:52:06.044800Z

@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.

2020-09-04T22:52:42.045900Z

That's assuming you're looking for client side support. There's also a re-posh plugin somewhere if you're using re-frame.

2020-09-04T22:53:13.047Z

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.

stathissideris 2020-09-04T22:53:17.047400Z

Thanks! I was actually planning to use it with Java Swing

2020-09-04T22:54:30.048800Z

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.

2020-09-04T22:54:54.049400Z

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).

stathissideris 2020-09-04T22:55:14.049800Z

Ok thanks, I’ll give it a go

2020-09-04T22:55:53.051100Z

Cool! Excited to hear how that works for you.

stathissideris 2020-09-04T22:56:17.052300Z

I think if I can get the changes fro the transaction I might be fine with writing code that explicitly updates my swing gui

stathissideris 2020-09-04T22:56:32.052800Z

I really don’t want to invent react on swing

stathissideris 2020-09-04T22:56:45.053400Z

It’s too big a yak to shave 😄

2020-09-04T22:57:33.054300Z

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.

2020-09-04T22:58:42.055400Z

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.

stathissideris 2020-09-04T22:58:57.055900Z

It’s desktop, I’m writing a Clojure-based spreadsheet

1😎
stathissideris 2020-09-04T22:59:45.057Z

Thanks, but cljfx is already react-like so I’m not sure how applicable it would be in my case

2020-09-04T23:00:52.057400Z

Sure

2020-09-04T23:01:06.057800Z

Any reason you're bound to swing over javafx? 🙂

2020-09-04T23:01:37.058300Z

Clojure based spreadsheet, huh? Sounds cool 🙂

2020-09-04T23:02:03.058900Z

Interested in hearing what you're vision is there if you're able to share at this point.

2020-09-04T23:04:49.061600Z

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 🙂

stathissideris 2020-09-04T23:15:15.062400Z

I think I may have seen tad before, it’s mainly for pivots, right?

stathissideris 2020-09-04T23:16:05.064300Z

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

1👍
2020-09-04T23:16:07.064400Z

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.

stathissideris 2020-09-04T23:18:58.068600Z

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

stathissideris 2020-09-04T23:19:10.069Z

Not sure if there is a market

stathissideris 2020-09-04T23:19:45.069500Z

Here’s an early demo from a while ago https://youtu.be/dd0yBua-o18

2020-09-04T23:24:03.069800Z

Very cool 🙂

2020-09-04T23:24:12.070100Z

Do you have a target price point yet?

stathissideris 2020-09-04T23:24:38.070600Z

No idea, I’ve never sold software as a product before

stathissideris 2020-09-04T23:25:14.071900Z

I’ve mainly released open source and that’s easy to “sell” 😊

stathissideris 2020-09-04T23:26:09.072500Z

Is the video meant to be joke? :thinking_face:

2020-09-04T23:26:14.072700Z

Yes

2020-09-04T23:26:25.073100Z

Like: "Look at us, selling software."

stathissideris 2020-09-04T23:27:06.074100Z

Oh! 😀 Have you ever sold any software you made?

2020-09-04T23:27:26.074400Z

As a service, yes; Never a desktop app.

stathissideris 2020-09-04T23:27:51.074800Z

Desktop is weird these days

1✔️
stathissideris 2020-09-04T23:28:11.075600Z

I think there may be a market in finance for what I’m building

2020-09-04T23:28:52.076Z

I'd consider it

stathissideris 2020-09-04T23:30:40.078900Z

🎉

stathissideris 2020-09-04T23:31:05.080100Z

Great to hear, now all that remains is to build it 😀

1🤘
phronmophobic 2020-09-04T23:31:07.080200Z

@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

stathissideris 2020-09-04T23:35:16.084100Z

@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

1👍
stathissideris 2020-09-04T23:36:30.086100Z

I tried implementing a Clojure data structure inspector by drawing directly onto a canvas and it was way more effort than I had imagined

phronmophobic 2020-09-04T23:37:24.086400Z

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.

stathissideris 2020-09-04T23:37:31.086700Z

What’s your motivation for this?

stathissideris 2020-09-04T23:38:11.088Z

Yes, you’re right and I’ve ran into this sort of thing in the past

phronmophobic 2020-09-04T23:38:58.089100Z

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.

stathissideris 2020-09-04T23:39:32.090Z

And did you? (Build the app)

stathissideris 2020-09-05T11:06:53.103500Z

Like what? I’m curious

phronmophobic 2020-09-05T19:39:36.103700Z

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

phronmophobic 2020-09-05T19:41:23.104100Z

just saw one of your projects on reddit that I've used before, https://www.reddit.com/r/Clojure/comments/ils0kg/stathissiderisspecprovider/

phronmophobic 2020-09-05T19:41:47.104400Z

very cool project

stathissideris 2020-09-05T21:06:36.105400Z

Thanks for the list, it sounds like you’ve done quite a few things with it!

stathissideris 2020-09-05T21:06:50.106Z

Glad you like spec-provider 😊

phronmophobic 2020-09-04T23:40:16.090600Z

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

1👍
2020-09-04T23:40:26.090700Z

FWIW, I'll be probably 2x more likely to buy it if I can use Oz/Vega for vizs 🙂

stathissideris 2020-09-04T23:42:03.093Z

I’m only asking because yak shaving sometimes depletes my energy to the point of not wanting to do the original thing anymore

phronmophobic 2020-09-04T23:42:44.093300Z

I've been having a lot of fun improving the membrane

stathissideris 2020-09-04T23:43:58.094500Z

Some would say that you’re stuck in the membrane :rolling_on_the_floor_laughing:

1😁
phronmophobic 2020-09-04T23:45:26.094800Z

I've been building lots of one-off apps

stathissideris 2020-09-04T23:45:58.095700Z

Have you implemented scrolling in membrane yet?

phronmophobic 2020-09-04T23:47:21.095900Z

I have

stathissideris 2020-09-04T23:47:50.096700Z

Oh yeah it’s in the demo

phronmophobic 2020-09-04T23:48:15.097800Z

although, I have an irrational disdain for scrollviews, so I don't use them very often and support could probably be improved

stathissideris 2020-09-04T23:48:23.097900Z

That’s where I gave up

stathissideris 2020-09-04T23:48:38.098400Z

Text boxes couldn’t have been easy

phronmophobic 2020-09-04T23:50:24.099300Z

it's not too bad. I recently found https://github.com/mogenslund/liquid, which I'm trying to make better use of

phronmophobic 2020-09-04T23:52:06.100900Z

liquid has its own renderer(s), but the model is very flexible and you can easily integrate it with your own graphics model

stathissideris 2020-09-04T23:52:37.101700Z

membrane looks very interesting, I think I’ll devote some time to study your code

phronmophobic 2020-09-04T23:53:32.102400Z

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

stathissideris 2020-09-04T23:53:35.102600Z

Vega is definitely going to be part of this

stathissideris 2020-09-04T23:53:56.102900Z

Thanks!