Understanding unapply of case classes
I have this simple code:
Understanding unapply of case classes
I have this simple code:
What limitations does the JVM impose on tail-call optimization
Clojure does not perform tail call optimization on its own: when you have a tail recursive function and you want to have it optimized, you have to use the special form recur
. Similarly, if you have two mutually recursive functions, you can optimize them only by using trampoline
.
How do you encode Algebraic Data Types in a C#- or Java-like language?
There are some problems which are easily solved by Algebraic Data Types, for example a List type can be very succinctly expressed as:
Case Class naming convention [closed]
Closed 9 years ago.
How to read Scala code with lots of implicits?
Consider the following code fragment (adapted from https://stackoverflow.com/a/12265946/1333025):
Why does Scala require functions to have explicit return type?
I recently began learning to program in Scala, and it’s been fun so far. I really like the ability to declare functions within another function which just seems to intuitive thing to do.
Can Scala be considered a functional superset of Java?
Apart from the differences in syntax, can Scala be considered a superset of Java that adds the functional paradigm to the object-oriented paradigm?
Functional Methods on Collections
I’m learning Scala and am a little bewildered by all the methods (higher-order functions) available on the collections. Which ones produce more results than the original collection, which ones produce less, and which are most appropriate for a given problem? Though I’m studying Scala, I think this would pertain to most modern functional languages (Clojure, Haskell) and also to Java 8 which introduces these methods on Java collections.
What is a good use case for scala? [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for […]