clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
oliver 2020-11-19T00:01:55.406900Z

well… I was going to blame it on clj-refactor adding that dependency for me… but as I'm thinking about it it's doubtful… As I said, the last thing I did was evaluate a db-function to wipe a table, which I did inside the buffer containing that namspace… I may have thought that I was in another of the namespaces associated with a file named core (of which there are several in the Luminus template)… but still this would not have warranted inserting somehting in to the ns declaration just for a single eval… maybe I was just on autopilot or something… still find it hard to believe that I'd do anything like that consciously…

oliver 2020-11-21T20:07:48.031400Z

For the record: The same trouble has com up again… and this time I know why. It was indeed clj-refactor that automatically added the dependency: I qualified a function call from that namespace (`db.core`)` with the namespace db/myfun … pressing TABone time too often automatically added the dependency, which had gone unnoticed.

oliver 2020-11-19T00:12:34.410300Z

Anyway, I'm really grateful for the helping hands in here (hasn't been the first time, won't be the last)… I just wish the root cause had turned out to be more substantial to warrant all the fuss (this had been an issue for three days now, so I finally chose to ask) Cheers!

william 2020-11-19T12:20:09.414700Z

which datalog library would you suggest for clojure? I want to use it as an in-memory db. Is datascript the right choice?

borkdude 2020-11-19T12:37:57.415200Z

@meditans There is datascript, datahike, asami (datalevin is durable only faik)

borkdude 2020-11-19T12:38:15.415500Z

And also datomic in memory which is proprietary

dgb23 2020-11-19T13:10:58.419600Z

@meditans the datahike repo has a nice little description of the major differences between datascript datahike and datomic to guide your decision.

william 2020-11-19T13:31:05.420Z

thanks @borkdude @denis.baudinot, checking!

william 2020-11-19T13:37:34.421700Z

what would be the closest thing to this datalog package https://clojure.github.io/clojure-contrib/doc/datalog.html (which, if I understand correctly, is deprecated?). I'm exploring different possibilities, and maybe I could do without the overhead of connecting to a database and doing transactions. Basically I'd like to have the database as a value, and ask datalog queries

william 2020-11-19T13:38:30.422500Z

sorry for the vagueness, I just started learning Clojure and I'm quite unsure on how to orient myself in the ecosystem

borkdude 2020-11-19T13:40:23.422900Z

@meditans That's basically an in-memory datalog database like you asked earlier right?

borkdude 2020-11-19T13:40:36.423200Z

datascript is basically what this is, and there are some others

dgb23 2020-11-19T13:51:02.426300Z

If you are a beginner I can recommend checking out the following resources: Conceptual Introduction with pseudo-syntax: https://x775.net/2019/03/18/Introduction-to-Datalog.html Interactive Tutorial with Clojure Datalog syntax: http://www.learndatalogtoday.org/

william 2020-11-19T13:51:15.426600Z

I have to look more into datomic. Does that force me in structuring my db around the datom though? What if I wanted to store relations in my database with bigger arities?

dgb23 2020-11-19T13:51:45.426900Z

That is covered and its very simple

william 2020-11-19T13:53:15.428200Z

thanks @denis.baudinot. I'm a beginner in clojure indeed, I can write in prolog, and I'm trying to understand how to replicate some little features I need without talking to swi-prolog directly

william 2020-11-19T13:53:58.428800Z

like, to do the examples in learndatalogtoday in one of my projects, which package should I import?

dgb23 2020-11-19T13:54:52.428900Z

http://www.learndatalogtoday.org/chapter/0 Here you’ll find the interactive widget at the bottom

dgb23 2020-11-19T13:55:23.429100Z

the tutorial has little exercises with increasing complexity/concepts

dgb23 2020-11-19T13:55:41.429300Z

the syntax is equal to datomic/datahike/datascript

dgb23 2020-11-19T13:56:27.429500Z

to your other question: modelling relations is covered there. Essentially a value in a EAV dataom can be another entity (or several)

william 2020-11-19T13:56:53.430Z

yes, I found that website a few days ago, and I did part of the tutorials. My first problem now is not that language (which is awesome) but what I have to do to use that in a project instead of the repl on that website

octahedrion 2020-11-19T13:57:20.430500Z

@meditans another tutorial project here https://github.com/Hendekagon/Datalog-tutorial with code examples for Datahike and Datascript

👍 1
🙏 1
dgb23 2020-11-19T13:57:51.430700Z

ahh I see. Well I would just use the recommendations we said above. Use datahike if you possibly need durability or datascript if you simply want a in-memory value

dgb23 2020-11-19T13:58:07.430900Z

datomic for involved engineering requirements

william 2020-11-19T13:58:41.431200Z

thanks! I'll try installing datascript now

dgb23 2020-11-19T14:00:05.431500Z

there is also a #beginners channel here to ask questions regarding Clojure

william 2020-11-19T14:02:03.431700Z

thanks! I'll go there too 🙏

dgb23 2020-11-19T14:02:48.431900Z

also since your are comming from prolog don’t miss to also check out https://github.com/clojure/core.logic https://clojuredocs.org/clojure.core.logic

devn 2020-11-19T16:55:58.432700Z

how can i submit edits to existing guides on the clojurescript site?

devn 2020-11-19T16:56:15.432800Z

guides/webpack needs some love

dpsutton 2020-11-19T16:58:09.433Z

https://github.com/clojure/clojurescript-site

devn 2020-11-19T16:58:26.433300Z

thanks @dpsutton

👍 1
dominicm 2020-11-19T17:11:22.433800Z

Is there a common library which includes HTTP header parameter encoding, that will take care of all the encoding, commas, etc. for me? Particularly for parameterizing the Authorization header in a formencoded-ish style (but not quite, because commas instead of &). I feel unsafe when I write this code myself, as it's prone to going wrong :) e.g. foo=bar, baz=10

lukasz 2020-11-19T17:16:10.434400Z

I think clj-http handles all of that for you

2020-11-19T17:32:33.434800Z

I don't think there is a single standard "header parameter encoding"

2020-11-19T17:35:47.436Z

so for example https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization doesn't mention anything about keys value style stuff like foo=bar or comas, where https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate specifies a single required key=value pair and one optional key=value pair separated by a coma

dominicm 2020-11-19T17:40:41.436200Z

@hiredman Definitely isn't standard across all headers. There are "auth-params" which are joined. RFC 7235 does provide a BNF for this stuff and there is infinite numbers of params that can go in.

seancorfield 2020-11-19T17:48:17.437200Z

(a friendly reminder from one of your Admins to encourage beginners to ask their questions in #beginners rather than #clojure as the folks in #beginners have "opted in" to helping beginners in depth)

👍 1
2020-11-19T18:18:47.438Z

Does anyone have a recommendation for a Stripe Client library?

lukasz 2020-11-19T18:49:24.439100Z

I just call their API directly, it's pretty ok and a wrapper is unnecessary (not sure what it would do beyond a couple of utility functions)