Fork me on GitHub
#beginners
<
2016-02-24
>
mfikes00:02:02

@adamkowalski: You can elide asserts (including :pre and :post). In ClojureScript, for example, you compile with the :elide-asserts compiler option set to true.

seancorfield00:02:51

@adamkowalski: FWIW, at World Singles we went back and forth several times between core.typed and Schema and ended up removing both completely. We found both were too cumbersome for the benefits they provided.

seancorfield00:02:09

Schema is runtime only anyway and relies on you having extensive path coverage in your tests. core.typed can be run as a separate phase but it’s still very hard to satisfy its type inference and checking engine with idiomatic Clojure. CirceCI wrote about how they had been using core.typed extensively but gave up on it.

adamkowalski07:02:47

@mfikes: thats good to know, it seems like they may be the best option moving forward

adamkowalski07:02:44

@seancorfield: so now that you have had some experience with multiple different solutions, can you elaborate on a strategy you guys use instead of type checking or using schema? do you rely purely on tests, and if so how has that worked for you in larger projects

seancorfield07:02:05

First off, we try to develop nearly all code "live" via the REPL or in a strictly test-first manner (but mostly via the REPL).

seancorfield07:02:24

Second, we try to create idiomatic code that is natural to use (this is the hardest part - and it's a continual evolution). Idiomatic code is more natural to use so you're less likely to make mistakes when composing it. Functions are short, generally pure, carefully named, and all public.

seancorfield07:02:10

Third, good docstrings written in a consistent style "Given {description of each argument}, returns {description of result}. {specify if/when result can be nil}."

seancorfield07:02:06

Namespaces that match the business domain where possible.

seancorfield07:02:18

And communicate with your team.

seancorfield07:02:38

And, yeah, we have quite a lot of tests.

seancorfield07:02:55

About 10k lines of tests for about 30k lines of production code.

mariogintili10:02:08

anyone based in london happy to meet to work on a small clojure project? I’m a ruby/javascript developer that wants learn 😄

moizsj11:02:06

@mostr: thanks for the very helpful pointer

val_waeselynck13:02:53

@seancorfield: would have loved seeing that list a few months ago, you should totally blog this if you haven't already simple_smile

marco15:02:35

@mariogintili: Would hangout be an option, too?

mariogintili15:02:11

sure, it’s just to learn clojure - on a not-for-profit basis

mariogintili15:02:45

and if you have any ideas for a project even better 😄

doddenino15:02:00

An hangout would be cool! Noobs from all around the world united! 😄

mariogintili16:02:19

10 people with no skill cramped on the same function 😂

jcomplex17:02:56

That sounds pretty cool

seancorfield17:02:13

@val_waeselynck: I think it should be something the community could contribute to like the style guide https://github.com/bbatsov/clojure-style-guide

seancorfield17:02:37

That covers the code-level details but not the workflow / idiomatic best practices.

straistra18:02:14

@seancorfield: That sounds like a great idea. Unfortunately I'm much too of a beginner to be able to contribute to that in any meaningful way.

seancorfield19:02:55

@straistra: Beginners often have very insightful questions to ask — and those are valuable contributions too!

seancorfield19:02:16

But having a community "best practices" page on GH seems like a better option than a blog post, although I may start with a blog post about how we do stuff at World Singles, just to get enough input to create such a community page somewhere…

seancorfield19:02:47

… and as it happens we’re going through a big "business process documentation" phase at work already so some of it might fall out of that.

mull21:02:30

Given a vector [“a” “b” “c”], how could I partition (wrong choice of word perhaps) it to get a result like [[“a” “b”] [“b” “c”]]? i.e. pairs of [n n+1], but no lonely item at the tail. I can do this in ugly javascript, can’t really think of a nice functional way to do it

mull21:02:13

Aand just found it. (partition 2 1 vector)