Fork me on GitHub
#clojure
<
2020-11-19
>
oliver00:11:55

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…

oliver20:11:48

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.

oliver00:11:34

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!

william12:11:09

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

borkdude12:11:57

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

borkdude12:11:15

And also datomic in memory which is proprietary

dgb2313:11:58

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

william13:11:34

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

william13:11:30

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

borkdude13:11:23

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

borkdude13:11:36

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

dgb2313:11:02

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/

william13:11:15

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?

dgb2313:11:45

That is covered and its very simple

william13:11:15

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

william13:11:58

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

dgb2313:11:52

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

dgb2313:11:23

the tutorial has little exercises with increasing complexity/concepts

dgb2313:11:41

the syntax is equal to datomic/datahike/datascript

dgb2313:11:27

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

william13:11:53

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

dgb2313:11:51

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

dgb2313:11:07

datomic for involved engineering requirements

william13:11:41

thanks! I'll try installing datascript now

dgb2314:11:05

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

william14:11:03

thanks! I'll go there too 🙏

dgb2314:11:48

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

octahedrion13:11:20

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

👍 3
🙏 3
devn16:11:58

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

devn16:11:15

guides/webpack needs some love

dominicm17:11:22

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

lukasz17:11:10

I think clj-http handles all of that for you

hiredman17:11:33

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

hiredman17:11:47

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

dominicm17:11:41

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

seancorfield17:11:17

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

👍 3
tungsten18:11:47

Does anyone have a recommendation for a Stripe Client library?

lukasz18:11:24

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)