svg-clj icon indicating copy to clipboard operation
svg-clj copied to clipboard

Could you compare this to thing/geom?

Open kxygk opened this issue 4 years ago • 5 comments
trafficstars

I noticed you do a comparison to dali. Could you do something similar with thing/geom?

The whole thing/geom collection of libraries is huge - It's a mammoth piece of work that's very Clojure-y and extensible. I'm curious why reinvent the wheel instead of extending that. (maybe just for fun, :) ) It looks very similar but I'm guessing that I'm missing some critical design difference that makes what you want to do incompatible or fundamentally different.

It also doesn't come with a rasterizer btw. Just hiccup->svg/xml. I've used SalamanderSVG successfully (was quicker than Batik) as well as rendering directly with JavaFX primitives

PS: Thanks for ob-babashka.el :). I'm gunna try to do something similar for Clojure and thing/geom

kxygk avatar Jul 10 '21 13:07 kxygk

Thanks for your great suggestion. I've heard of thing/geom but it just didn't cross my mind to add it as a comparison.

It's a fair question wondering why I've made this lilbrary instead of usign thing/geom. The first reason you actually mention:

  • thing/geom is huge and thus a potential (admittedly subjective) no-go for some people. In fact, I'll admit that as I was first learning Clojure, I found thing/geom and turned away from it due to the shear volume of namespaces. In short: it didn't feel accessible to me. svg-clj is much smaller in scope and so may be a 'quick and easy' tool for some situations.
  • This library is absolutely a project for fun/learning on my end. But, I do feel quite strongly that there is enough utility here to be valuable to at least a few people.

Finally, I suspect there are some design differences that I would have to look into further and add to the readme.

Once again thanks for the suggestion, I really appreciate getting input from the community :)

Btw, glad you like ob-babashka.el. I'll keep my eyes open for work with thing/geom!

adam-james-v avatar Jul 10 '21 20:07 adam-james-v

Ah, yeah, I get how it looks overwhelming. I had the same impression at first. It's actually just a suite of mini-libraries that mostly work independently

If you look at the original master branch and its org literate stuff then it should be relatively easy to understand. Here is the SVG one: https://github.com/thi-ng/geom/blob/master/geom-svg/src/core.org

This can be used independent of the rest of the geom project and I think it's doing a lot of things similar to you. It's sorta just 3 parts:

  • a serializer to go hiccup->SVG/XML
  • some "utility" stuff.. colors/transforms/etc
  • basics "shape" functions that take params and return hiccup

The other namespaces in geom can be thought of in two ways:

  • even lower level stuff that's used by SVG and other namespaces: ex matrix/vector/color
  • higher level stuff that usually leverages SVG: ex: I mostly use geom-viz, this make declarative plots, and it will use the SVG namespace to generate those

So then when you want to extend the functionality you write your own mini-library in effect and you can leverage the existing ecosystem. Though.. frankly I've barely scratched the surface when it comes to that myself :) . I've only really just wrote my own hiccup-JavaFX serializer

If I get a babel mode working then I'll post a link/example here :))

kxygk avatar Jul 11 '21 08:07 kxygk

I never managed to make a babel mode. The ELisp wouldn't comply :)

But I did make a setup with ob-clojure. Maybe you'll find it useful

https://geokon-gh.github.io/literate-clojure.html

The last example kinda showcases thing/geom firing at all cylinders

Hope it's useful!

(there are also a lot of little details I couldn't work out - in the green Note sections.. feedback and tweaks much appreciated)

kxygk avatar Jul 15 '21 02:07 kxygk

Wow, thanks so much for sharing this :)

It'll be great to go through in more detail when I have the time (life's a tad busy at the moment, but hey, that's how things go).

I think with your example here I can put together a nice comparison! Again, really appreciate your input.

I'll run things on my machine soon and see if I can give any feedback :)

adam-james-v avatar Jul 15 '21 22:07 adam-james-v

Oh please take your time. And if you don't get around to it, don't worry. I was just working on this literate mode thing on my own and came across your lib and your ob gist. That's all. I was gunna make that write up anyway.

If you have any feedback of suggestions at some point that'd be great - but I didn't mean to give you any extra work :)

kxygk avatar Jul 17 '21 11:07 kxygk