Skip to content
Advertisement

Tag: functional-programming

What is the advantage of using scala pattern matching instead of java switch case?

Everybody says that pattern matching is a great feature in functional languages. Why? Can’t I simple use ifs and switch cases for everything? I’d like to understand the advantages of using pattern matching instead of regular procedural programming ifs and switch cases Answer I’d first like to note that you don’t use pattern matching “instead” of switch statements. Scala doesn’t

zip function for Java

Is there some standard API or established third party library (I am thinking commons or Guava) that provides in Java the equivalent of zip or map vector function in languages like Ruby or Clojure? So the signature (for two collections) would be: where Pair would also be presumably defined in that library. I know its trivial to implement but maybe

Can anyone explain me what is state and mutable data?

In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. http://en.wikipedia.org/wiki/Functional_programming Can anyone explain me what is state and mutable data? Can anyone give me examples in either JAVA or JavaScript. Answer mutable suggest anything that can change, i.e. an int In java a string is

Advertisement