Fork me on GitHub
#clojure
<
2022-08-21
>
teodorlu07:08:43

Hi! Is there prior work on "Makefile as EDN"? Something like: • EDN-based "it's just data" format that can represent a Makefile • Mappers from Makefile to edn data and back I did some rough sketching here: https://play.teod.eu/makefile-edn/ --- I'm aware that bb tasks solve a lot of related problems, but I'm specifically looking for "backwards compatibility" with plain makefiles.

wombawomba08:08:11

We're doing this something similar with https://polytope.com 🙂

👀 2
wombawomba08:08:42

Not exactly the same thing though; we're solving a lot of similar problems that Makefiles solve, and in a "environment-agnostic" way (run locally or against the cloud with the same "makefile"). The backwards compatibility idea is really interesting. What's the use-case? Makefiles are pretty annoying to write/parse (especially if you want to support the different Make dialects)

teodorlu09:08:53

> The backwards compatibility idea is really interesting. What's the use-case? > Basically, a zero downside "potential upgrade path". I find that Makefiles work quite well. But it's a big string with syntax, so it's hard to generate programmatically. If I had a data representation with conversion both ways, I could: • Experiment with programmatic generation of the file as data • Completely rely on make • And simply convert back to a normal Makefile if I don't want the added stuff on top of make later.

teodorlu09:08:05

I'll read up on your stuff, thanks for the reference!

teodorlu09:08:30

Looks like you're tackling a problem that's way more difficult than just makefiles. Interesting! Enjoying your clojure api examples right now.

teodorlu09:08:36

Is there more information about pricing / planned business model / licensing anywhere? You mention that it's possible to run Polytope on my own infrastructure.

teodorlu09:08:45

Looks like an end parenthesis is missing here:

parens 1
teodorlu09:08:51

Also, I'd really appreciate a "next" button in the docs. I'm realizing that this is work in progress :)

teodorlu09:08:38

Your docs are very well written!

wombawomba09:08:49

I'm glad you've found it interesting! We haven't published anything on pricing yet, but the gist is you can either use http://polytope.com (free to use, pay for server/disk usage), run it on-prem (free, pay for support/enterprise features), or run the CLI locally (free, period).

👍 1
wombawomba09:08:45

Yeah, the docs are a bit... incomplete. We're actually about to push a major update to them today/tomorrow

wombawomba09:08:03

The product itself is pretty much ready to use (with some caveats) - we're further along than the docs would suggest.

👍 1
teodorlu09:08:40

Thanks for explaining! You're definitely addressing some relevant problems with current tools like Github workflows.

wombawomba09:08:07

Good to hear! If you're interested in trying it out, I'd be happy to chat more about use-cases and/or get you in the beta (probably better suited for PM so we don't spam this channel 😉).

👍 1
Ben Sless10:08:08

Babashka tasks?

teodorlu10:08:35

yeah, babashka tasks is probably the idiomatic solution for this in most clojure projects! Bonus that you don't have to learn Makefile syntax / Makefile semantics at all, you can just write Clojure. > I'm aware that bb tasks solve a lot of related problems, but I'm specifically looking for "backwards compatibility" with plain makefiles But as far as I'm aware, there's no translation layer from/to makefile from those tasks? And then you have to model makefile dependencies not as dependencies between files, but as dependencies between which task must run first? Or is perhaps there a way to have "declarative dependencies within files" in babashka that I don't know about? --- My impression is that the idiomatic babashka solution is to model dependencies between tasks, and call out to fs/modified-since imperatively in each task? (see for example https://blog.michielborkent.nl/speeding-up-builds-fs-modified-since.html)

teodorlu11:08:30

Or would you then just model the data dependencies in EDN, and hook into it with tasks? That could work I think :thinking_face: "It's just data"

Tala Tarazi13:08:58

Hi all, I'm using HugSQL to connect my clojure code to postgreSQL. and I'm trying to create a query that contains CASE Expression. Something like,

Update table 
set "value"= 
case id when 1 then "one"
when 2 then "two"
end 
where id in (1,2)
and I couldn't find the right syntax to send the value for the case I sent it as string didn't work. Does anyone know how to solve it? Thanks 🙏

Jimmy Miller14:08:47

I haven’t used hugsql. But in your question it isn’t clear what value you are trying to “send”. If you can make that more clear, people might be able to help. I will note though that double quotes and single quotes in sql are different. You’d want to use single quotes on ‘one’ and ‘two’. Single quotes make strings. Double quotes refer to sql columns and tables and such.

Tala Tarazi16:08:20

I am not able to convert (case id when 1 then "one" when 2 then "two end) into HugSQL syntax. I keep getting syntax error on it.

Jimmy Miller16:08:45

Do you get the same error when just running it as plain SQL? What is the error?

borkdude21:08:26

TIL that metadata on a key isn't updated if a key already existed in a map:

user=> (-> (find (assoc {(with-meta 'x {:dude true}) 1} (with-meta 'x {:dude false}) 2) 'x) first meta)
{:dude true}

andy.fingerhut22:08:17

That is not something that I've ever seen advertised as part of the contract of assoc, or anything like that, but it is what the implementation happens to do for built-in Clojure maps. There might be third party implementations of maps that do replace the key object with the new key object (and its metadata, if any) on assoc operations.

ghadi23:08:11

from the perspective of the map, they are two identical keys

ghadi23:08:53

keys are compared by value equality, comparisons cannot take metadata into account.

1