public int max(int a, int b) { return new If( new GreaterThan(a, b), a, b ); }
Disregarding the entire fucking issue of speed, how is this shit more readable?
Grayson Ward
wtf? This looks even worse than Java.
Camden Bennett
Yeah that's why I called you a math retard. Too stupid to understand it you code monkey.
Zachary Long
It doesn't, stop damage controlling.
Ryder Gutierrez
Hey, man. Math is great. And so is functional programming. Shilling against a tool in the toolbox for some kind of personal gain is a fucking kike-esque attitude and you should feel bad.
Your OP was also a complete shitpost. How do you know FP is shit if you've never even heard of it? What kind of closet do you live in where you have never even heard of Ruby et al?
Ryder Ross
Gov.uk uses Scala
Dylan Martinez
I've been on Sup Forums for years and deliver code examples on a regular basis.
Sup Forums likes to bash everything, this includes OOP.
>"The stories and information posted here are artistic works of fiction and falsehood. Only a fool would take anything posted here as fact."
>You want to see what religiously pure OOP looks like?
I always found the OOP models of Smalltalk/Ruby (quite similar) and Scheme/LISP/JavaScript (also quite similar) pretty good.
I think Ruby is one of the pures OOP langauges out there.
But yes, I understand what you mean: Stuff like map/reduce/filter or the for-each-loop are typically functional constructs, yet they are so common that people often forget about that.
Personally I don't think it's a "black or white"-thing, why not use functional enumerators with objects and classes? Best of both worlds.
>inb4 "muh purity"
So basically they are using Java with a bunch of Scala classes for the coolness?
Just kidding, Scala has really a nice approach. I plan on learning it the next year. I'm only afraid that it's pretty tempting to "cheat" and use Java-like style every now and then..
Can you recommend it?
Christian Parker
>You're not going to have pure FP anywhere Elm is pretty much as pure as it gets. Even 'purer' than haskell, as it enforces complete functions, doesn't have undefined and doesn't have unsafePerformIO. Not that pureness is any form of measure whether something is good.
Gavin Baker
>What big mission critical software projects are written in functional programming, Sup Forums? People use the best from both worlds, OP. There's a reason why virtually all modern programming languages and frameworks use concepts both from object-oriented design as well as functional programming.
>I had never even heard of FP before in nearly 12 years as a software developer, Then you are most likely a completely shit developer to be quite honest. Even self-taught programmers get exposed to functional concepts just by using existing frameworks and being moderately interested in the field of software engineering.
Noah Lopez
Amazon Netflix Australian Post Capital One Database Labs Deutsche Bank eBay LG Oracle Spotify Soundcloud Aviso...
And many more are using Clojure.
FP programing is all over the place in critical back-ends, and big data situations. It's just never made a big splash outside of that because it's not easy or accessible as things like python. And the lack of documentation and tutorials puts casuals off. It's there, but out of sight out of mind. If it was not half the shit you use every day would not be working.
Hunter Jackson
>Here are the things I think do not belong in a pure object-oriented language: >flow control (for, while, if, etc.) wut
Hudson Collins
Why not? If you want to be 100% pure, everything has to be an object. Having flow control statements would mean it's a procedural language with OO on top.
It's kinda like lisp, where everything is a list
Easton Rodriguez
you ditch your FOR loops and only use something like object.forEach(procedure())
It kind of sucks.
I personally think a "pragmatic" approach is better, and not just with OOP having procedural stuff but also having functional bits and declarative too.
If you've seen C# lately you would understand:
>WPF displaced winforms for the Views. Declarative > OOP here
>LINQ is FP and replaces procedural+OOP Database Queries.
Jayden Robinson
Isn't flow control a necessary subset of every turing complete language though?
Daniel Diaz
This is flow control. It's just hidden behind an abstraction. A pretty shitty abstraction if you ask me, but someone obviously thought this is a good idea.
Ethan Walker
>It's just hidden Meh Python is best language, followed closely by C.
Jackson Scott
>you ditch your FOR loops and only use something like object.forEach(procedure()) >It kind of sucks
I think it's way more elegant to use functional iterators.
Let's write a short function that uses an array, replaces some values, concats them and prints as output. I will write it in Ruby two times, but the first time I try to be as "old schoold" as possible, then second time I use an functional approach.
Here is a traditional/procedural/OOP way of doing it, similar to C, Java or Go:
some_array = ["op", "is", "a", "faggot"] result_string = "" i = 0 while i < some_array.length if (some_array[i] == "a") some_array[i].replace("always a") end
if (i%2==0 && i 96 && some_array[i][j].ord < 123) some_string += (some_array[i][j].ord - 32).chr else some_string = some_string + some_array[i][j] end j += 1 end some_array[i] = some_string end
result_string = result_string + " " + some_array[i] i += 1 end result_string = result_string + "!!" puts(result_string)
Now the same thing in a "functional way" like you would do it langauges like Ruby, Python or Haskell:
p ["op", "is", "a", "faggot"] .map {|x| x=="a" ? "always a" : x} .map.with_index {|x,i| (i.even? and i
Jayden Campbell
>C is pretty shitty for processing strings This is news to literally nobody. Also your code is shit it puts a leading space at the start of the output.
Joshua Cooper
None.
Most mission critical is first modelled using formal methods (See en.wikipedia.org/wiki/Formal_methods) to test that your model is complaint to the domain and range of your problem.
The problem with that is that (AFAIK) there are no tools to help you turn your tested automaton into a compilable language that can go into whatever you're making (e.g. a minimal system) so you will have to translate the model into a real programming language, this is where mistakes are made.
Where as FP is nice for enforcing a model, you will find that there are not many people using because they're not very memory efficient (en.wikipedia.org/wiki/Functional_programming#Efficiency_issues). On the other hand, modern languages are adding support to FP so this might improve in the future, but I still think is unlikely that people will switch from one paradigm to another and/or using in mission critical software.
Joseph Lee
> if (i%2==0 && i
Ayden Reyes
>i==1 err, 0
Owen Wright
>half the shit you use every day would not be working It would, just in another language.