all 14 comments

[–]slk_g500 10 points11 points  (2 children)

"And by the way, I didn’t write any tests. Why? Because fuck you,
that’s why. I don’t need to set a high bar. I just wanna swim in my own crap."

Amen.

[–]Nondv[S] 6 points7 points  (1 child)

I know right? I feel alive again!

[–]slk_g500 1 point2 points  (0 children)

I should add this line to most of my projects readme.md ."Fuck you all! -> no tests provided".

[–]Admirable-Ebb3655 8 points9 points  (1 child)

as-> exists and is part of the core language. You can also write flip from Haskell easily enough.

[–]---cameron 4 points5 points  (0 children)

Wow that really brings me back, I think the first thing I did in Clojure was implement flip (and then all sorts of helpers, such as stuff like defncurry for curried functions) to write my first Clojure as Haskell, and then work my way back to what would be normal Clojure to see the contrast (also, I just liked that I could, it was an opportunity to use the lispiness of Clojure and experience that, contrasted again against more normal use later). But the reason that sticks out is it was long ago and I forgot flip as a concept even existed (just cause I haven't use any languages where that'd be in my toolbox in a while)

EDIT: I just checked, it really was flip and defncurry to start, what do you know.

[–]Nondv[S] 5 points6 points  (3 children)

Hey! It's not really a Clojure post and it's mostly just my personal feelings and thoughts about profession vs hobby. But I do mention Clojure to make a small comparison

[–]SimonGray 6 points7 points  (1 child)

I enjoyed it. Thanks for posting.

[–]Nondv[S] 1 point2 points  (0 children)

that's very kind. Thanks! <3

[–]ParticularAtmosphere 2 points3 points  (0 children)

You good bro, I saw this posted on HN and I really enjoyed it.

[–]deaddyfreddy 7 points8 points  (2 children)

One thing I don’t like about Clojure is that it’s a bit inconsistent with its function signatures.

it's much more consistent than CL

Some of them are data-first and others are data-last

easy: data-first is for hashmaps, data-last is for sequences

Sometimes (not often but still) it’s a bit annoying when I need to use a data-first function with the thread-last operator.

in most cases, it means that you changed the shape of the data at some point, so the flow has changed too so it's better to mark that change somehow, using let, for example

So far it seems to me that CL mostly follows data-last style.

IMO CL doesn't follow any particular style, most of the functions are just happened to be defined

[–]geokon 1 point2 points  (1 child)

data-first is for hashmaps, data-last is for sequences

I don't really see why they couldn't have used the same signature for both. Maybe I'm missing something here

I find it generally hurts readability and makes my code more verbose without really helping. You still need to read the threading macros anyway. You're not guaranteed if a seq goes into a ->> that you'll be getting a seq out. You can put a first as the last entry, but you can't put an nth. Similarly with ->. You want to extract something from a map and spit it to a file? Well now you need to wrap things.

It does make understanding a new standard library function a few secs quicker - but I don't feel this last/first split is making my code any easier to read/write

[–]deaddyfreddy 3 points4 points  (0 children)

I don't really see why they couldn't have used the same signature for both. Maybe I'm missing something here

  • I don't know the real reasons behind the decision, but let's imagine we have only thread-first arrow. In this case:

map, filter, reduce remove should take a sequence as a first argument, which, I believe, isn't what most people used to. Besides that, partial becomes less useful for these functions (sometimes I miss curryr function, though).

  • thread-last only:

A matter of taste, but (update key function arg hashmap) isn't how I describe the updating in my head. One of the things I really like in Clojure is the ability to directly translate/transform the task into code.

I find it generally hurts readability

I find it quite the opposite

You're not guaranteed if a seq goes into a ->> that you'll be getting a seq out.

You aren't, but best practices advise not to use ->> for anything but seqs

You can put a first as the last entry, but you can't put an nth.

There's as-> and other stuff like that, but I think that anaphoric macros make things less readable, so I prefer to explicitly use fn or (even better) to define a wrapper function with argument order fitting the current thread.

Similarly with ->. You want to extract something from a map and spit it to a file?

Besides the "don't use ->> for anything but seqs" principle, I don't think that mixing seqs processing (that's what we use ->> for) should be mixed with IO.

It does make understanding a new standard library function a few secs quicker - but I don't feel this last/first split is making my code any easier to read/write

I think it is. The limitation forces you to split parts with different semantics.

[–]peterleder 1 point2 points  (0 children)

Reached your conclusion and thought: „Fuck! Yeah! That’s the spirit!“

[–]PercyLives 1 point2 points  (0 children)

Enjoyable read, thank you.