Fork me on GitHub

morning 😼 mogge


On the subject of do's and don'ts for Clojure, I'd really like to see more material describing (and forgive me for using this term as short hand) "best practices". Specifically, I see huge variation in the way Clojure is structured in the micro and the macro. One of the huge advantages with Clojure is the speed with which it can be used to explore a problem. However, I believe we pay the price in the fact that the characteristics that make Clojure a powerful exploratory/new development tool (dynamic typing, terseness, meta programming) also tend to lead to a lot of variation in the way code is structured and the cues we use to scan code (especially determining what inputs and outputs look like). As we tend to spend approximately 80% of our time reading and understanding code we should really spend more time optimizing for maintenance. This is also why I take the deeply unpopular view that Frameworks are not evil and certainly give that consistency. Spring and Rails have their issues but you can get an awful lot of sh*t done with them over a long period of time once you learn the idioms. We should spend more time giving higher level idioms for how to structure Clojure and, even more so, Clojurescript. To that effect, I'd like to see more material like "Clojure Applied". Phew, that's a lot to type on my phone!


@thomas it's a good investment IMO


I'll put it on my list of things to read


just realiser that Carin Meier is this week in Rotterdam for Joy of Coding... and I should have gotten a copy of living Clojure for her to sign!


Dan North has some good thoughts on best practices


in short s/best practice/in context X, Y worked well for me/


Morning 🙂


Good to see Clojure Applied being mentioned here. I was literally looking at it yesterday after reading another thread on books for Clojure newbies and thought it looks like a good companion to Living Clojure which I got for Christmas


Will definitely add it to the top of my "must buy this book next" list


@seancorfield shared this on another slack group I'm on and I thought it made some interesting points so re-sharing here 🙂


That article took an improving slant 🙂


I like it... but I have only three problems. Time, time and time.


Although, coming in a C → Python → Clojure direction, I feel like that has captured most paradigms. Particularly as Clojure has good OO, and I've been able to use Datalog a lot (declarative). Though I'd like to do more declarative.


type-classes as a macro - my current fave example of the sort of new stuff you can do when you mix up some of those paradigms in new ways (in this case - syntactic abstraction of lisps, functional abstraction, static typing) -


A language that captures side effects in the type system is worth learning too I’d say


@agile_geek in some ways I think clojure is a framework (as far as lisps go) in that if you so things that look like seqs and maps then everything works really well. Stray from that and you end up building a lot yourself.


Hello everyone... Anyone in the vague vicinity of Chancery Lane -> Liverpool Street and fancy getting lunch?


@maleghast how long did it take you to get to London form "up north"?


The usual amount of time (1hr 15min flight), sadly we took off a little over 3 hours late, so I could only get to my accommodation in a reasonable timeframe by hopping in an Über


Got to where I was staying at around 0300h


Still good trip, all things considered and I am off to Stanstead later - should be home at around 2200h as long as there are no delays.


ok, that doesn't sound to bad actually. but lots of flying I guess.


@thomas I think a lot of people assume learning other languages takes more time than it actually does -- have you tried the Seven Languages in Seven Weeks books? I found I could work through those, an hour or two a night while watching 📺 with my wife. Took longer than seven weeks but it wasn't a huge burden.


Although I will say Io totally kicked my butt 😐


And they pick a really good spread of paradigms across the two books. Four months of an hour or two here and there and that's thirteen languages covering nearly all the main types of languages! Clojure crops up twice (once for the language itself, and again for mini-Kanren).


I like that they do "uncourses" for minikanren via hangouts and post the links afterwards. This is a really neat approach


@thomas - Hi (been getting to the airport)... Yeah, it's a lot of flying, but barring emergencies I'm only doing the trip one more time before the end of the summer, so it's not so bad... 🙂

Rachel Westmacott16:06:48

I think that the more languages you learn, the easier it is to learn more languages.


and some languages have an outsized effect on your future language comprehension abilities, so you should deliberately pick those languages to learn


@mccraigmccraig Definitely! I tend to advise folks learn a handful of “really different” languages first, even if they never program in them later. I always used to suggest APL, Haskell, and Prolog. But APL has become harder and harder to actually practice (given all the symbols) and I think J just looks like line noise so I’m not sure what to recommend there.


seancorfield: It might be time for me to "dust off" my copy of 7 in 7


But as Thomas says, it's a matter of finding time. I've got that talk I've volunteered myself for which is a Clojure learning experience, and I've got some moonlighting I need to do inbetween which "complicates" my evening schedule


But at least you’re on the path… and the conference talk will ensure you learn enough Clojure to be dangerous 🙂


That's my hope anyway simple_smile


Also, a Lisp of some flavor (so many to choose from — but I’d definitely recommend Clojure these days).


hey hey! 🙂


What’s this doing (potemkin/import-vars [clj-ssh.ssh connected? connect disconnect]) above and beyond what :refer would do?


Is :refer even equivalent? Kinda looks like it to me…


This is why I am (slowly) learning Elixir alongside attempting to ascend to "competent" with Clojure 😉


@mattford the imported vars will appear def'd in the namespace, so referenceable from other ns ... a :refer makes the name usable within the namespace but not referenceable from elsewhere


ah excellent explanation thanks


Warning: Potemkin does “magic” and can cause all sorts of compatibility problems with some other libraries 🙂


oh - i haven't had any of those problems - i've found potemkin to be quite useful for structuring apis


what are the compatibility probs it causes ?


@mccraigmccraig I don’t recall specifics — just that I’ve seen several people warn others off using it (and I have run into problems with Potemkin when it’s been pulled in as a transitive dependency… I think I just solved it by switching to a library that didn’t use Potemkin).


That said, we’re using clj-http 3.4.1 and that pulls in Potemkin 0.4.3 and we’re OK at the moment…


us too - we're using aleph and a few other libs which pull in potemkin 0.4.3, and our stuff uses it in a few places - i've not seen any problems


creates a new var with the same content and a copy of the metadata of the original var... plus a watch on the original var so that changes are reflected to the new var


tho i guess you could have problems if you are depending on atomicity of alter-var-root or alter-meta!