News for hackers. Stuff that matters.
Re:Software reuse is more like an organ transplant than snap... by hencq on Wednesday June 24, 2020 @09:59PM (#23636079)
Nicely put. That aligns very nicely with the philosophy behind Clojure and for instance less so with Haskell. In Clojure you usually use only a few data types, often (immutable) hashmaps. A program then simply becomes a series of functions that transform data.
Re:Software reuse is more like an organ transplant than snap... by UK-Al05 on Thursday June 25, 2020 @09:56AM (#23640788)
Don't people clojure try to wrap primative types. Say an Address type? Or is that not a thing?
Re:Software reuse is more like an organ transplant than snap... by platz on Wednesday June 24, 2020 @10:06PM (#23636113)
Anytime someone mentions a nice thing about Haskell, you can be sure a Clojure programmer will appear shortly, without being previously referenced, to try and disparage them.
Re:Software reuse is more like an organ transplant than snap... by adamkl on Wednesday June 24, 2020 @10:17PM (#23636195)
Not sure where the hostility is coming from. I didn’t read anything disparaging about Haskell in hencq’s comment. He/she just made a factual statement about Clojure’s approach to data types being analogous to Unix/strings when it comes to composition.

It comes with the same drawbacks (the lack of static typing is similar to strings with Unix; you have to be aware of the details of the data coming in and out because there is no type system to save you - unlike Haskell), but the benefit is easier composition.

Re:Software reuse is more like an organ transplant than snap... by hencq on Wednesday June 24, 2020 @11:33PM (#23636626)
Yeah, I didn't mean anything disparaging about Haskell at all. I only mentioned Haskell as an example of a functional programming language. I tried to make a point (apparently poorly) about the easy composition that using a limited number of (dynamic) types enables. Of course all the usual dynamic vs static tradeoffs apply. Thanks for doing a better job explaining that :-)
Re:Software reuse is more like an organ transplant than snap... by crimsonalucard5 on Thursday June 25, 2020 @03:53PM (#23644822)
I don't think dynamic typing or static typing really applies.

In either case you have to compose functions With the correct types otherwise you hit an error. The difference with dynamic types and static types is when this error occurs. Run time for dynamic types and compilation time for static types. Either way some type of error will always occur regardless.

Though I agree with you if you have a limited number of types things become easier to deal with.

Re:Software reuse is more like an organ transplant than snap... by mcv on Thursday June 25, 2020 @06:26AM (#23638984)
This is something that also works well in the nicer parts of javascript. Now nobody is ever going to accuse javascript of being a good functional language (disparage away), but at its core, you've pretty have arrays, maps, numbers, strings, booleans and functions. An Object is really just a map of key-value pairs where some values are functions. You can .map() an array of objects to an array of strings by feeding it a function that turns an object into a string. It's really nice to build those little blocks and cobble them together into something that accomplishes something more complex.
Re:Software reuse is more like an organ transplant than snap... by crimsonalucard5 on Thursday June 25, 2020 @03:56PM (#23644866)
I use to be pretty negative about JS, but typescript saves the day. The lego aspect of functional programming always becomes more evident when you have static types.
Re:Software reuse is more like an organ transplant than snap... by mcv on Friday June 26, 2020 @04:33AM (#23649922)
I've been getting more mixed about Typescript lately. Quite often, you end up with everything being `any`, and every time you write something, the compiler makes you hunt down the missing types.

But being able to specify interfaces for lambdas is absolutely fantastic. Something like: "this function takes an object and returns a function that can take either a string or a number and returns a number" is easy to do in Typescript, and useful for figuring out where the lego block fits.

Re:Software reuse is more like an organ transplant than snap... by slifin on Thursday June 25, 2020 @03:41AM (#23637906)
Clojure's static analysis tools can warn you of incompatible types

I.e. this will warn (inc "hello") in clj-kondo

Re:Software reuse is more like an organ transplant than snap... by mrslave on Thursday June 25, 2020 @03:52AM (#23637974)
It was kinda funny, and not nasty at all. Let's assume good faith here?
Re:Software reuse is more like an organ transplant than snap... by crimsonalucard5 on Wednesday June 24, 2020 @10:16PM (#23636190)
I mean what he describes is literally the same thing as haskell. Just untyped.