Fork me on GitHub
#clojure
<
2018-03-24
>
greglook02:03:27

I will second the semi-negative Korma experience - it works well with simple data models, but starts getting unwieldy if you need to do more complex things. Also global state makes for some occasionally hard-to-understand magic. This was a while ago though, so could be different now. Currently using HoneySQL and some macros to simplify the coercion from relations to entity maps, very happy with the direct control over the statements.

xtreak2906:03:09

In spec I want to model a map where some keys depending on the value of one key. {:type :circle :radius 12} and {:type :rectangle :x-side 10 :y-side 10. Should I write ::circle and ::rectangle and then do (s/def ::shape (s/or :circle ::circle :rectangle ::rectangle) ?

Michael Fiano06:03:46

Is there any macro or such for checking a bunch of predicates at once without anding and passing the same argument over and over? For example I want to convert this: (and (int? x) (pos? x) (odd? x)) into this: (some-op int? pos? odd? x) or ((some-op int? pos? odd?) x)

Michael Fiano06:03:14

Scratch that. every-pred is what I was looking for.

xtreak2906:03:10

How can I specify something like {:type :circle } and {:type :rectangle } and I can't have it as (s/def ::circle-type #{:cricle } and use (s/def ::circle (s/keys ::req-un [::circle-type]) and rectangle-type because then it will make user supply :circle-type and :rectangle-type instead of using :type with different values.

daveliepmann07:03:26

@jmckitrick @arrdem consider spicerack, "a Clojure wrapper for MapDB — a fast, disk-persistent data-structures library." https://github.com/jackrusher/spicerack

daveliepmann07:03:04

Clojure-idiomatic storage of Clojure data structures to disk

sarna11:03:17

is enlive abandoned?

cgrand11:03:10

@mailmeupinside more “done” than abandoned.

sarna11:03:46

:thinking_face: interesting God, these new emotes are disgusting thanks for answering though

MegaMatt11:03:51

I started walking through an om next tutorial a few months ago, now i am working on a re-frame project and when i download the project and lein figwheel it starts a server on the specified port and says it compiling the right resource buy my browser loads the om next tutorial html. I tried changing the port but still no luck. any ideas?

gklijs12:03:44

'lein clean' before 'lein figwheel' and/or make sure there is nothing cashed in your browser.

MegaMatt12:03:14

i've tried both.. i even stooped so low as to open up ie browser since i know it won't be cached there tumbleweed

gklijs12:03:26

Maybe there's a bug in the new cljs cashing, I'm not sure where it's stored.

MegaMatt12:03:26

i installed bash on windows and lein / java on there and oddly it still is showing me the om project html :man-shrugging:

MegaMatt12:03:23

okay, so oddly enough if i hit localhost:3450 it shows the om next page but if i hit localhost:3450/example.html then it shows the right resource

hlolli13:03:33

someone had the experience of useing postal for smtp mail delivery and get something spam filtered

Caused by: 
com.sun.mail.smtp.SMTPSenderFailedException: 550 5.7.1 Rejected: <removed-my-ip> listed at |
it's from my dev machine, worried if this could happen on production server

jmckitrick14:03:40

My colleagues like the LINQ-inspired syntax of Slick. I don’t see anything like that for Clojure yet

tatut14:03:47

korma is the closest I think

tatut14:03:33

clojurians don’t seem to like cutesy DSLs as much

tbaldridge14:03:15

Linq leans quite hard on the type system in c#. It’s a bit harder to pull that off in a lisp

jmckitrick15:03:12

I found an article pointing out some serious performance problems with Slick, actually

matan16:03:08

Slick was horrible to work with, 3 years ago, for me

matan16:03:18

I assume you're talking about Scala's slick

jmckitrick17:03:28

@matan Can you fill me in? I have a colleague who insists it’s wonderful, and he is reluctant to us Clojure without something similar. I need to convince him, or find an acceptable compromise.

matan17:03:29

Well, my best explanation would be he's more intelligent than I was/am, so as to get along with the horrible API that Slick used to be at the time

matan17:03:25

Not only the API, but I think using slick implies avoiding query optimization or some other performance implication I cannot correctly recall now. Sorry for not being helpful.

matan17:03:23

Anyway I don't think any Scala dev will switch to clojure, unless you're one already 🙂

jmckitrick17:03:32

I do recall reading about query optimization issues. And I’m the hard-core Clojure guy. I have one colleague 100% on my side, and this guy is supportive but with reservations.

matan16:03:17

would it be very non-idiomatic to create my own exception class? couldn't find any mention of it in the docs either, only an outdated discussion here https://stackoverflow.com/questions/3835331/custom-exceptions-in-clojure

noisesmith16:03:33

@matan yes, use ex-info which allows attaching arbitrary data to an exception

matan16:03:48

great! I had a feeling there's a more idiomatic way

noisesmith16:03:12

you can use a multi-method or whatever on the ex-data of the exception in the catch block

matan16:03:43

so essentially that's an exception type that only clojure code would normally use... with some clojuresque goodies with it

matan16:03:53

i'll read it up

matan16:03:26

@matthewdaniel are you really using om next?

MegaMatt16:03:04

@matan I was trying to learn it, didn't make it very far before getting distracted. I'm now learning re-frame

matan16:03:36

I've always regarded them to be something that will never catch on

MegaMatt16:03:53

them? you mean both re-frame and om?

matan16:03:10

from a naive perspective, they look like opinionated layers of libraries that nobody is using nor maintaining very properly

matan16:03:07

I hope to be disproven..

MegaMatt16:03:35

i picked re-frame since i am coming from react/redux world and it looked pretty close. do most people just use plain reagent?

matan16:03:50

don't want to mislead you, i would not know

matan16:03:15

to avoid installing and battling bleeding edge libs only to Stockholm syndrome yourself with them, you should probably ask (somewhere)

petterik17:03:10

I think there are a lot of users of re-frame and I think it's being well maintained. I personally chose to learn and build something with om.next for 2 years. It was hard to learn but there are some very good ideas in there. There's a group of people who have created a framework building on top of om.next (now replaced it with their own) it's called #fulcro and its github repo is very active: https://github.com/fulcrologic/fulcro/graphs/commit-activity

MegaMatt00:03:53

wow, good to know. om looks really promising so good to know there is an active implementation

matan05:03:15

would you really build something on something built on top a variant of the experimental (good ideas granted) om.next? for a hobby project, maybe

matan05:03:20

nice story acutally: > Fulcro expands on the work of David Nolen’s Om Next, and that code represents about 30% of 2.0’s code base. Much of the core API is similar, but this library is intended to be an easier-to-use alternative that follows the original simplicity of design while eliminating some experimental features of that library, and rounding out the story with a complete concrete implementation that is easy to use.

petterik09:03:12

I think it's reasonable for companies to consider building their product(s) on top of Fulcro

noisesmith16:03:59

@matan ExceptionInfo is a subclass of exception, you catch that specifically - yeah

noisesmith16:03:11

you can have a clause for ExceptionInfo and another for regular Exception etc.

matan16:03:22

yep, got it :thumbsup:

matan17:03:16

I assume there's some idiom for making sure the exception is a clojure (ex-data) one too is there?

matan17:03:08

otherwise a plain unexpected exception in some Java component would crash a naive clojure catch block

noisesmith17:03:28

@matan you can have multiple catch blocks (try (f) (catch ExceptionInfo e ...) (catch Exception e ...))

matan17:03:28

oh well, I'll just catch ExceptionInfo

noisesmith17:03:34

that's what I was trying to say earlier

noisesmith17:03:03

it's the same thing you'd have to do if you subtyped Exception, which was your original question

matan17:03:53

great to have clojure exceptions which carry data!