News for hackers. Stuff that matters.
Re:Python Idioms in Rust by apendleton on Friday March 30, 2018 @03:50PM (#16719262)
Honestly I suspect that this stems from a perception particularly among people from a non-traditional CS background that "functional programming" is intimidating, whereas Python is seen as approachable in a get-shit-done kind of way for programming novices. Python definitely did co-opt a lot of traditionally functional stuff, but did it in a way that obviates needing to know what a monad is, concern oneself with functional purity, etc., so there's a community of people now who don't care about any of that but are still familiar with some of these idioms, and this post is meant to make Rust look more accessible to them in a way that "Rust supports functional programming idioms" would not.
Re:Python Idioms in Rust by coldtea on Friday March 30, 2018 @05:49PM (#16720069)
>Honestly I suspect that this stems from a perception particularly among people from a non-traditional CS background that "functional programming" is intimidating, whereas Python is seen as approachable in a get-shit-done kind of way for programming novices.

Just people from a "non-traditional CS background"? Most CS graduates today will say the same thing with regards to e.g. Python vs Scheme or CL.

>Python definitely did co-opt a lot of traditionally functional stuff, but did it in a way that obviates needing to know what a monad is, concern oneself with functional purity, etc.

If you hanged around HN pre 2010, you'd seen that FP was all about Lisp (and things like map, reduce, macros, first class functions, etc), and few gave a rat's arse about "monads" and "purity" -- it was only starting to emerge in general consciousness, not dominant as it is today in FP circles.

Re:Python Idioms in Rust by ansible on Friday March 30, 2018 @06:49PM (#16720462)
>: If you hanged around HN pre 2010, you'd seen that FP was all about Lisp (and things like map, reduce, macros, first class functions, etc), and few gave a rat's arse about "monads" and "purity" -- it was only starting to emerge in general consciousness, not dominant as it is today in FP circles.

My recollection was a bit different. I got interested in Haskell around 2007 or so. And pre-2010, I recall encountering several articles about that on HN, though obviously there were often articles about the Lisp family.

Re:Python Idioms in Rust by pjmlp on Saturday March 31, 2018 @01:24AM (#16721898)
As someone that learned FP when Haskell did not exist and Miranda papers were still fresh, this mentality that only Haskell matters as FP notion really feels odd.
Re:Python Idioms in Rust by OtterCoder on Saturday March 31, 2018 @10:21AM (#16723390)
I personally feel like Haskell makes a good reference implementation for functional programming. Whenever someone is explaining how to do some interesting FP thing in, say, JavaScript, I usually just ignore them and go read about how the same thing is done in Haskell, which is usually clearer and less burdened with the complexity of getting a mutable, proceedural, eager language to behave like an immutable, lazy, functional one.
Re:Python Idioms in Rust by jholman on Saturday March 31, 2018 @11:21PM (#16726531)
If you think that immutability and laziness are inherently part of functional, then you're part of the new-school-is-the-only-school problem.

I mean, I'm not saying that immutability and laziness aren't interesting. But FP has a long long history, most of it's not lazy, and immutability is nowhere near universal.

Re:Python Idioms in Rust by willtim on Saturday March 31, 2018 @10:45AM (#16723488)
Completely agree. Anyone interested in functional programming should learn Haskell for this reason alone. Skip the blog post that falsely claims a "functor is a box" or a "monad is a burrito" and go read the original papers.
Re:Python Idioms in Rust by supergarfield on Friday March 30, 2018 @05:05PM (#16719788)
This is tangential to your main point, but:

> did it in a way that obviates needing to know what a monad is, concern oneself with functional purity,

Caring about both of these things in the context of functional programming essentially dates from the early 1990s. According to Wikipedia (I have no better source, but it matches what I know of pre-1990s functional languages),

> Eugenio Moggi first described the general use of monads to structure programs in 1991.

Functional programming existed before then. Scheme, an early functional language, is from the 1970s. It has basically all the FP idioms that you have in Python, is not pure, is dynamically typed, and the doc never once references monads.

I'd actually say the definition of FP has shifted towards pure, category-theory oriented languages, but "traditionally functional stuff" definitely doesn't include monads.

Re:Python Idioms in Rust by coldtea on Friday March 30, 2018 @05:53PM (#16720096)
>Functional programming existed before then [1991]. Scheme, an early functional language, is from the 1970s.

Lisp is even older, as was touted as the de facto functional language since forever. And earlier MLs didn't have monads either.

And of course, just because Moggi described monads in 1991, it doesn't mean it didn't take over a decade for them to make any kind of significant dent.

(Assuming that they have made much of a dent today, which outside the world of Haskell, their explicit (as opposed to implicit) use is close to 0, anyway).

Re:Python Idioms in Rust by willtim on Saturday March 31, 2018 @10:53AM (#16723532)
The problem with "traditionally functional stuff" was that one could only use functional programming for a subset of problems. Monads allow Haskell programmers to use FP to solve problems involving IO, mutation and effects. This is not redefining FP, it is extending it to a wider class of problems.
Re:Python Idioms in Rust by papito on Friday March 30, 2018 @05:53PM (#16720095)
You are saying that Python is like the Bill Nye of functional programming: not really a scientist, but does make it accessible to the masses.
Re:Python Idioms in Rust by vvanders on Friday March 30, 2018 @05:57PM (#16720126)
Saying someone who was a mechanical engineer was "not really a scientist" kinda does him a bit of a disservice.

What made Bill Nye awesome was not only his passions for the subject matter but a solid background that let him communicate complex topics in a simple and engaging way.

Re:Python Idioms in Rust by kbenson on Friday March 30, 2018 @07:25PM (#16720634)
Not to mention I don't recall him really calling himself a "scientist" in any formal sense, but my exposure to him has always been tangential. He was the "Bill Bye the Science Guy" in his original show, and afterwards I've always seem him explained as a science advocate.

I mean, what's a scientist anyway? If it's someone in constant pursuit of knowledge, does a constant reading of new material to learn more count?

Re:Python Idioms in Rust by icebraining on Friday March 30, 2018 @07:44PM (#16720716)
I'd say a scientist is someone who advances science, not just someone who reads results by others (unless they publish a study based on those results, like a meta-analysis or similar).
Re:Python Idioms in Rust by kbenson on Friday March 30, 2018 @08:14PM (#16720863)
Does that mean the scientist that tests hypothesis that never works out, and never bothers to publish, isn't a scientist?

What about the person that actually does advance knowledge, for their self, but doesn't share it? Are you not a scientist if you don't let everyone know what you found? You would conceivably still be performing science.

Maybe the easiest way to define it as someone that intends to discover something new (or at least add new data to existing data, for corroboration or refutation)? I don't consider myself to be a scientist, but if I wanted to explore some topic in depth, and and started reading about it, and maybe performing my own small scale experiments to confirm what I had read, I think I would be "doing science" and I would then be at a minimum am amateur scientist.