This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-17
Channels
- # beginners (42)
- # cider (1)
- # cljs-dev (20)
- # clojure (73)
- # clojure-italy (8)
- # clojure-nl (53)
- # clojure-spec (11)
- # clojure-uk (88)
- # clojurescript (170)
- # clojutre (6)
- # core-async (26)
- # css (2)
- # cursive (13)
- # data-science (10)
- # datomic (15)
- # editors (3)
- # figwheel (28)
- # figwheel-main (67)
- # fulcro (57)
- # graphql (2)
- # immutant (2)
- # jobs (1)
- # jvm (4)
- # lein-figwheel (3)
- # leiningen (1)
- # off-topic (5)
- # pedestal (28)
- # re-frame (86)
- # reagent (18)
- # reitit (8)
- # ring (3)
- # ring-swagger (2)
- # shadow-cljs (78)
- # spacemacs (10)
- # specter (12)
- # tools-deps (32)
- # vim (3)
Morning 😪
Morning
I might need a ✨ ☕ ✨
@manas.marthi what has you up so early?
Morning morning
Mornin'
bad dreams
Bore da
https://stuartsierra.com/2018/07/06/threading-with-style slightly more interesting
in that as->
example above, the pattern I was shown was declaring a partial inline
so if you declare a partial it returns an fn and you then just make sure the arg you want is the first of the restargs
any reason for avoiding partial?
or do you mean, just in threading?
because comp + partial is a pretty useful thing...
altho I guess transducers are now the hot new newish thing 🙂
We avoid it because it makes the arguments extremely opaque, and also something about "haskell people" 😜. I think that #()
does make it clearer how the function is expected to be called.
Yeah, we do the same. The few places we've used a fn with different ordering inline of a thread we've used #()
that's fair
so you mean you'd wrap the fn you want in a higher order #()
construction?
I actually prefer partial to #()
, I find it easier to reason about, I know that it was the first args that have been curried and usually implies you’ve thought about the order of args. Whereas #()
you could have curried curried any of the args to the function and I need to read closer which ones you’ve curried
@firthh interesting, I have the opposite mentality. I immediately have to figure out which arities the callers of the f
will be using, and it is a pain. Where as with #()
I know exactly what is expected.
I even dislike conveniences over consistency like [clojure.string :as str]
vs [clojure.string :as string]
. Always the latter!
I'll hold my hands up and say I probably would go for the former there :)
I don't understand why string is special and is renamed to str when everything else is just has clojure.
dropped off the front.
I dunno, a lot of the clj I've seen gets ns's crunched down to as few chrs as possible
yeah, I see that too. It confuses the hell out of me. In one ns my.cool.app.models is models/
and in another my.cool.app.db.models
is models/
, I can't cope with the congitive overhead.
I want ONE alias per project, don't care if it's long, I have auto-complete for that.
yeah so that's a good example
bc I've seen a lot of code where that would be
:as wu
:as au
The correct answer is [app.models :as models]
and [my.cool.app.db.models :as db.models]
nice, I don’t know why I never thought of using a .
in an alias before. I’d used -
’s for the same effect. Will definitely adopt this convention.
strange I hadn’t picked up on that, as I’d read the stu sierra post.
https://stuartsierra.com/2015/05/10/clojure-namespace-aliases largely I think this
hahaha
idk I tend to think as long as it's consistent within a project, it's whatever rolls off the keyboard and reads best
in most cases that'll be the full word, but sometimes if it's better to be terse then I'll take wu
au
dbio
fio
or whatever
Don’t you think that what he calls a blackboard / context map is simply procedural namespace?
and tbh if I'm only using it once in a ns (e.g. a fn in clojure.string
) I'll sometimes just use the full path, clojure.string/join
or whatever
If the full path is in the body of the code then surely you still know where it's coming from. If anything an alias makes it less clear, because you have to go and check the ns aliases.
@alex.lynham you require it first though right? 😄
well, if it's in the project deps then it's available to you via that path
(unless I've misunderstood yr question 🙂 )
hm, looking through source code it looks like I'm lying, it is required and I don't really see a case where I've got it as a full path
though I did find an example of terse requires
because it's not io
but you want to signal that the other namespace is the input and output boundary of your program
bc
isn't included in that ns but it's used elsewhere in the project
contrived example maybe
But why not just http://needlecast.io? 🙂
ncio is not as nice as http://needlecast.io
ah that's because I don't like the .
character in an alias
...which sounds irrational when you write it down
but it's not, I promise 🙂
I'd go with http://nc.io if I was using it a lot.
I'll go with the grain of the project but yeah probably prefer the shorter one. If other people got upset in review I'd either use the longer one or
Yeah, we do the same. The few places we've used a fn with different ordering inline of a thread we've used #()
Just when I thought my thing was working, it looks like the db transaction is rolling back silently...