News for hackers. Stuff that matters.
Re:The beauty of functional languages in deep learning – Clo... by workthrowaway on Thursday September 12, 2019 @07:04AM (#20950103)
always wonder why functional languages or constructs are often described as being beautiful or using other aesthetic terms. just strange that they are the only ones we ascribe such attributes, among the few paradigms and the many coding styles out there.
Re:The beauty of functional languages in deep learning – Clo... by mlthoughts2018 on Thursday September 12, 2019 @09:45AM (#20951361)
Usually people who talk like this haven’t dealt with functional programming in the real world. I fell in love with the beauty of functional programming in grad school.

After using Haskell in a real business setting for many years, no thanks. The code and headaches and weird bugs are just as bad as with any other language or paradigm. The type checking doesn’t actually help you to create functionally correct systems at all (let alone the false claims that it makes this process faster). Putting designs into the type system doesn’t matter. It’s little more than a useful mind-expanding way to think about code, but ultimately just as applicable to other paradigms. Mutating state is very often the right tool for the job. Plenty of experienced functional programmers write immutable, pattern-focused functional programming implementations that are full of bugs, confusing misdirection, unsafe handling of data, etc.

Library support is still insanely poor compared with C/C++, Python and Java. You have to insanely careful not to allow architectural astronauts to build out inscrutable systems that satisfy their weird personal opinions about aesthetics or interface design.

Hiring more engineers is super hard. Building in safety for when senior engineers choose to leave is even harder.

Integrations with emerging technologies like new database systems or new statistical packages always lags way behind other languages and usually exists in some half-finished form that depends on labor of love from some isolated hobbyist.

In terms of basic business decision making, I cannot recommend enough to avoid functional programming.

Re:The beauty of functional languages in deep learning – Clo... by edw on Thursday September 12, 2019 @10:49AM (#20952089)
I don't agree with your conclusions, but that didn't stop me from upvoting your comment. You touch on all sorts of important issues management should consider while deciding whether to adopt an oddball programming language or technology as the basis of its business. I write this as a CTO that chose Clojure as the basis for our now-acquired and fully-metabolized-by-the-buyer startup.

You better make sure the person who is advocating for the oddball technology…

* Is going to stick around; even cofounders sometimes bail or get caught.

* Understands the opportunity costs i.e. what is being given up by not using boring tech.

* Has used the tech on the ground and not just in a comp sci lab or to implement a to-do app.

* Will be able to grow i.e. recruit additional members to the team as the needs of the business grow.

* Really is a 10X programmer -- assuming they exist.

* Can sell the decision (in a way that doesn't consume undue positive karma) to VCs, customers, acquirers, etc.

In my situation, Clojure worked for us because I'd already spent years writing Clojure (and Scheme and Lisp) code and I understood the problem domain (I was the head of product at the time) and I had made a personal commitment to the CEO to stick around for at least two years and I managed to not get arrested or do anything awkwardly disgraceful. We also got lucky in that Clojure had a bit of a moment as a smart person's programming language in the mid two thousand teens.

If I weren't hands-on, I probably wouldn't have advocated for Clojure and instead would have opted for something mainstream for backend infrastructure at the time e.g. Java, Node.js, Python.

Re:The beauty of functional languages in deep learning – Clo... by jimbokun on Thursday September 12, 2019 @10:35AM (#20951921)
> Integrations with emerging technologies like new database systems or new statistical packages always lags way behind other languages and usually exists in some half-finished form that depends on labor of love from some isolated hobbyist.

This really sets Clojure apart from Haskell, in that you can use any Java library with almost zero friction.

Re:The beauty of functional languages in deep learning – Clo... by mlthoughts2018 on Thursday September 12, 2019 @11:20AM (#20952455)
I don’t have experience in Clojure but I do have experience in Scala where this claim is also made often.

In Scala anyway, it’s totally false. Firstly there’s just a huge impedence mismatch between code relying on Scala features and code serving as a Java wrapper into Scala. But even just the basic usage of the libraries doesn’t always work.

I very nearly quit a job once just from the incredible frustration of trying to use JFreeChart in Scala.

Re:The beauty of functional languages in deep learning – Clo... by jimbokun on Thursday September 12, 2019 @11:45AM (#20952799)
For a while, a few years ago, I wrote a lot of scripts and personal tooling in Clojure, calling Java APIs. I don't remember really having any difficulties calling Java code from Clojure.
Re:The beauty of functional languages in deep learning – Clo... by blandflakes on Thursday September 12, 2019 @12:30PM (#20953411)
It's a very different world in Clojure. Data structures mutually satisfy the relevant interfaces, and there's no real pain about how a java.util.Map isn't immutable and so on.
Re:The beauty of functional languages in deep learning – Clo... by BasDirks on Thursday September 12, 2019 @01:10PM (#20953856)
> The type checking doesn’t actually help you to create functionally correct systems at all (let alone the false claims that it makes this process faster).

This is a red flag to me. Of course the tool doesn't guarantee the result, but your story smells of incompetence. I've introduced FP and a focus on types-as-a-tool at the places I've worked and hired accordingly. Quality and speed of development have gone up after minimal time investment. A battle of n=1 I guess?

Re:The beauty of functional languages in deep learning – Clo... by mlthoughts2018 on Thursday September 12, 2019 @01:17PM (#20953932)
Not really. People make all kinds of crazy claims about the benefits of static type checking or compiler enforcements. These are perfectly fine tools, but you can achieve the exact same thing with a low effort set of unit tests most of the time.

The teams I’ve worked on with functional programming always had super senior engineers, people who had previously spent serious time on core GHC development and people who had worked as compiler engineers at e.g. Lightbend. They displayed all the same sources of slowness, defects, deadline and/or feature creep, bad designs leading to required refactors or rework, etc., as any teams I’ve been a part of that do everything in Python.

Static type enforcement is just a tool like anything else. It locates a certain class of code problems at compile or type checking time, that’s all. In most large projects, speeding up the detection of this class of errors is just not very important, and can be extremely well approximated with low effort test cases and other techniques.

Re:The beauty of functional languages in deep learning – Clo... by verttii on Thursday September 12, 2019 @01:19PM (#20953956)
This kinds of harsh yet legitimate criticism puts me off from spending more time on the notoriously steep Haskell learning curve.
Re:The beauty of functional languages in deep learning – Clo... by tome on Friday September 13, 2019 @01:32AM (#20959445)
I wouldn't let it put you off. mlthoughts2018 is pretty much the only commenter on HN who has seriously used Haskell yet also complains about it.
Re:The beauty of functional languages in deep learning – Clo... by verttii on Friday September 13, 2019 @03:01AM (#20959845)
But on the other hand, it's been hard to put my finger on the tangible benefits of all that time spent on Haskell. I'm worried that I end up going deep into that rabbit hole without really benefiting from it.
Re:The beauty of functional languages in deep learning – Clo... by tome on Friday September 13, 2019 @05:19AM (#20960479)
I think that's fine, as long as it's your own decision from your own experience. On the other hand if you're struggling with anything in particular then we tend to be friendly and helpful over at https://www.reddit.com/r/haskell/. The monthly Hask Anything threads might be useful for you.
Re:The beauty of functional languages in deep learning – Clo... by verttii on Friday September 13, 2019 @07:02AM (#20960960)
I've posted questions there before but unfortunately got no replies. However, some friendly folks at Slack helped me a lot.
Re:The beauty of functional languages in deep learning – Clo... by throwaway286 on Thursday September 12, 2019 @12:01PM (#20953014)
Do you have any thoughts on Elixir? I've been playing around with it and Haskell at the same time. Compared to Haskell, Elixir's dynamic type system and impurity make it a lot more practical to get stuff done, in my experience.
Re:The beauty of functional languages in deep learning – Clo... by verttii on Thursday September 12, 2019 @01:24PM (#20953996)
I'm just like you. I use Elixir for anything serious and Haskell for personal or small scale projects.

The way I see it is that Haskell abstracts away the runtime considerations. You spend the majority of your time modeling your business domain in Haskell. Or rather, retrofitting your business model into Haskell's type system.

In Elixir, in contrast, you spend the majority of your time building systems, in other words on runtime problems. All the tooling and even the whole OTP revolves around this. For anything that runs on the web, this is a major benefit compared to Haskell.

Re:The beauty of functional languages in deep learning – Clo... by mattmcknight on Thursday September 12, 2019 @07:26AM (#20950225)
I have actually had similar appreciation for Ruby, and humane interfaces in general.

Beauty can be misleading, as suggested in "Lost in Math: How Beauty Leads Physics Astray" https://www.amazon.com/dp/B0763L6YR7/

Re:The beauty of functional languages in deep learning – Clo... by szemet on Thursday September 12, 2019 @09:05AM (#20950943)
My suspicion is that people like declarative better than imperative. When a program reads as a definition it seems to be much more innocent than a bunch of commands.

Same split between descriptive/theoretical, and applied science. The first just increase knowledge - pure innocence without side-effects - the second may build bombs.

(But in the end both functional programs, and pure knowledge made with the intention to go through some interpreter with side-effects (computer/human) anyway...)

Re:The beauty of functional languages in deep learning – Clo... by cstpdk on Thursday September 12, 2019 @07:12AM (#20950136)
I have, evidently to too small a circle of people, described several non-FP coding styles and paradigms using aesthetic terms such as "ugly"
Re:The beauty of functional languages in deep learning – Clo... by pure-awesome on Thursday September 12, 2019 @07:29AM (#20950244)
The way I understand the parent comment (and I am open to correction), the question is why do we specifically describe functional programming with terms such as 'beautiful' - why do we not use say 'beautiful' for paradigms such as object-oriented, or aspect-oriented, or event-driven?
Re:The beauty of functional languages in deep learning – Clo... by foxes on Thursday September 12, 2019 @08:18AM (#20950561)
People find order and structure attractive. Functional programming is associated to that.

I feel like functional programming - maybe more from a categorical perspective - is good at generalising and capturing lots of ideas cleanly. For example you could think of object-oriented programming as using comonads - Haskell is an object oriented language! :).

I feel like that power to connect ideas, and see how they fit into some "larger" structure is what is beautiful. Being able to say what is "really" going on behind the scenes (yeah well really you are just using monads to do x...), being able to draw connections, and then use that to potentially discover new ideas is what is attractive.

Usually other programming paradigms are not constructed from a more rigorous mathematical perspective, but if its a good idea, don't be suprised if you cant describe it with fp.

Re:The beauty of functional languages in deep learning – Clo... by jimbokun on Thursday September 12, 2019 @11:06AM (#20952300)
Object Oriented in Smalltalk is absolutely beautiful.

What gets called Object Oriented in C++ and Java is decidedly not.

Aspect oriented programming as used in Spring is a nightmare. Maybe it's beautiful in some other implementations?

Re:The beauty of functional languages in deep learning – Clo... by UK-Al05 on Thursday September 12, 2019 @08:19AM (#20950568)
I would read the john backus turing award lecture to see why people have such appreciation of functional programming.

In short it's makes it easy to compose things, using a simple core language.

Re:The beauty of functional languages in deep learning – Clo... by dunefox on Thursday September 12, 2019 @12:26PM (#20953380)
IIRC is talking about function programming in the sense of J, not about functional programming in the sense of Haskell.
Re:The beauty of functional languages in deep learning – Clo... by the_af on Thursday September 12, 2019 @08:43AM (#20950755)
I don't think it's exclusive to FP. I've read many times people describing Lisp, Ruby and Python code as "beautiful".
Re:The beauty of functional languages in deep learning – Clo... by mlevental on Thursday September 12, 2019 @07:12AM (#20950134)
this is a pet peeve of mine - the use and abuse of humanist terms in stem. you see this a lot in a math - beautiful proofs, beautiful formulas, etc. I think it's a really weird perverse even thing to look at something purely formal (mechanical) and call it beautiful - like brutalist architecture - I think it says something about the person making the claim (that they appreciate structure to an inhuman extent).
Re:The beauty of functional languages in deep learning – Clo... by tmountain on Thursday September 12, 2019 @08:22AM (#20950594)
Humans naturally associate aesthetic qualities with all sorts of things. An appreciation for the things around you makes life richer. Maybe you don't like the word beautiful in this context (or feel like it's overused), but I wonder if you'd argue with using the word elegant to describe something like quicksort or a cleverly composed fibonacci function? Beauty takes many forms, and getting hung up on nomenclature seems silly TBH. Characterizing this appreciation as perverse and inhuman is essentially taking offense to someone else's enjoyment in something they appreciate. Seems pointless.
Re:The beauty of functional languages in deep learning – Clo... by mlevental on Thursday September 12, 2019 @09:07AM (#20950969)
elegant is fine. beauty and elegance aren't the same thing.

>Characterizing this appreciation as perverse and inhuman is essentially taking offense to someone else's enjoyment in something they appreciate. Seems pointless.

it's a humanist critique of the use of language for rhetorical purposes...? the purpose is exactly to investigate what the significance of that particular word choice is.

Re:The beauty of functional languages in deep learning – Clo... by fnordsensei on Thursday September 12, 2019 @09:42AM (#20951322)
Does elegance describe well-defined observable properties that are independent of the observer?

The point being, that if not, we're still within the domain of the subjective. It seems arbitrary to allow one set of subjective descriptions and disallow another.

Re:The beauty of functional languages in deep learning – Clo... by mlevental on Thursday September 12, 2019 @09:56AM (#20951464)
elegant: "the quality of being pleasingly ingenious and simple; neatness."

definitely less subjective than beautiful. and it's not arbitrary - i've alluded to an argument that can be made. i'm not going to spell it out because as usual no one on here is receptive anything that doesn't valorize stem.

Re:The beauty of functional languages in deep learning – Clo... by jjuel on Thursday September 12, 2019 @11:54AM (#20952935)
Beauty: "a combination of qualities, such as shape, color, or form, that pleases the aesthetic senses, especially the sight."

So I cannot like the shape or form when I look at a proof or function? I cannot have my aesthetic senses pleased by looking at STEM field things?

Re:The beauty of functional languages in deep learning – Clo... by mlevental on Thursday September 12, 2019 @05:46PM (#20956815)
i'm sorry but what is the shape or form of a proof? a function maybe - and calligraphy is certainly an art but what's wholly different from what the function encodes.
Re:The beauty of functional languages in deep learning – Clo... by tempWinHater on Friday September 13, 2019 @12:12PM (#20963392)
Proofs have structure, i.e., shape or form.
Re:The beauty of functional languages in deep learning – Clo... by mlevental on Saturday September 14, 2019 @11:46AM (#20971534)
they have a logical structure (claim, lemma, lemma, proof, etc.). they do not have a shape in the sense that the person i responded to intends.
Re:The beauty of functional languages in deep learning – Clo... by sweeneyrod on Thursday September 12, 2019 @07:27AM (#20950230)
I think the exact opposite; an aesthetic sense for proofs/code is usually required to be a good mathematician/ programmer.
Re:The beauty of functional languages in deep learning – Clo... by cstpdk on Thursday September 12, 2019 @07:15AM (#20950153)
This is quite an elitist position to take. Why is it inhumane to find beauty in structures? Human society is riddled with structure
Re:The beauty of functional languages in deep learning – Clo... by TrackerFF on Thursday September 12, 2019 @09:19AM (#20951074)
I like elegance. Beauty is highly subjective, but I think elegance is more focused on simplicity and efficiency - though still tied up to beauty.

Basically; If someone says that something is beautiful, it's pretty much in the eye of the beholder. If someone shows that something is very simple but effective, it's much harder to argue against.

If a line of code can replace a block of code efficiently, while still maintaining readability and cleanness, then that's something I would call elegant code.

Re:The beauty of functional languages in deep learning – Clo... by mlevental on Thursday September 12, 2019 @09:22AM (#20951113)
elegant is a fine word: "the quality of being pleasingly ingenious and simple; neatness."
Re:The beauty of functional languages in deep learning – Clo... by ashtonbaker on Thursday September 12, 2019 @10:21AM (#20951741)
I don't think it's clear at all that the natural grouping or division should be "STEM" vs "humanities". I think that mathematics belongs much closer to the humanities, especially philosophy and aesthetics, than to science or engineering.
Re:The beauty of functional languages in deep learning – Clo... by mruts on Thursday September 12, 2019 @06:47PM (#20957286)
Most colleges give you a BA for mathematics not a BS, btw (to reinforce your point). Which I think makes sense. Conputer science for some reason usually nets you a BS though, despite not being related to science in the least bit (and almost the same as math).
Re:The beauty of functional languages in deep learning – Clo... by jakeinspace on Thursday September 12, 2019 @09:15AM (#20951032)
Software is written and maintained by humans. Buildings are designed and lived in by humans (I happen to like many brutalist buildings). They are not purely formal, they need to have psychological appeal; pathos + logos.
Re:The beauty of functional languages in deep learning – Clo... by mruts on Thursday September 12, 2019 @10:35AM (#20951918)
Wait, so according to you, what can be called beautiful? Only people and maybe animals I guess?
Re:The beauty of functional languages in deep learning – Clo... by BasDirks on Thursday September 12, 2019 @01:12PM (#20953877)
Isn't appreciation of structure _precisely_ human?
Re:The beauty of functional languages in deep learning – Clo... by jlg23 on Thursday September 12, 2019 @08:18AM (#20950560)
How should it have been phrased?