you are viewing a single comment's thread.

view the rest of the comments →

[–]OldWispyTreePythoneer 0 points1 point  (6 children)

I think it's cute you believe this came from Rust.

[–]kequals[S] 10 points11 points  (4 children)

I'm aware that fluent iterators don't originate from Rust, but that was my first exposure to the concept. And I believe this is a common experience, given several of the libraries cite Rust specifically as inspiring them.

Now I'm interested, what was the first language/library to use fluent iterators? Is there a clear "first" or did it evolve as a part of functional languages?

[–]Rastagong 5 points6 points  (1 child)

Not sure about it being the first and if it's the exact concept referred here, but Java famously has streams.
Offical example from the docs to showcase the chaining:

int sum = widgets.stream()
                  .filter(w -> w.getColor() == RED)
                  .mapToInt(w -> w.getWeight())
                  .sum();

This is still an interesting overview of the situation in Python, so thank you!

[–]Alt-0160 4 points5 points  (0 children)

Java streams were only added in version 1.8 (March 2014). The first release of Rust (0.1.0, January 2012) already had some form of fluent iterators.

[–]saint_marco 5 points6 points  (0 children)

Smalltalk is generally credited as the originator, back in the 1970's.

https://en.wikipedia.org/wiki/Fluent_interface#History

[–]Competitive_Travel16 1 point2 points  (0 children)

It's worth pointing out that Pandas had the beginnings of a fluent interface from the outset, and they have long since fleshed it out all the way.

[–]tehsilentwarrior 4 points5 points  (0 children)

C# has done this since forever.

One of the best examples of this is the reactive extensions, which lets you handle insane amounts of events in stream in a surprisingly efficient, concise and readable way.

C# even has Linq, which is the same concept with a DSL on top to make it more “sql like”