Tagged Questions

57
votes
20answers
3k views

Why Option[T] ?

I am a beginner to functional programming and I have recently started studying Scala and I really love this language for the all goodies it provides like closures, pattern matching, currying etc. ...
51
votes
9answers
3k views

functional programming - Is Immutability Expensive?

Request: The question is two part. The first is conceptual, comparing functional and imperative programming from the perspective of cost of immutability. Second, about specifics of java/scala. ...
42
votes
12answers
11k views

Functional Programming in Java

Is there a good library for functional programming in Java? I'm looking for stuff like Predicate and List.Find() (as a static method). Not complicated to implement, but it would be nice to find a ...
29
votes
9answers
21k views

Stack overflows from deep recursion in Java?

After some experience with functional languages, I'm starting to use recursion more in Java - But the language seems to have a relatively shallow call stack of about 1000. Is there a way to make the ...
29
votes
5answers
7k views

Are there any good Clojure benchmarks?

Edit: The Clojure benchmarks are up on the Benchmarks Game. I have made this question community wiki and invite others to keep it updated. Is anyone aware of benchmarks of Clojure's performance? ...
27
votes
4answers
3k views

How can I transition from Java to Clojure?

After discovering Clojure I have spent the last few days immersed in it. What project types lend themselves to Java over Clojure, vice versa, and in combination? What are examples of programs ...
25
votes
12answers
8k views

How do I identify immutable objects in Java

In my code, I am creating a collection of objects which will be accessed by various threads in a fashion that is only safe if the objects are immutable. When an attempt is made to insert a new object ...
24
votes
10answers
2k views

Are there any provable real-world languages? (scala?)

I was taught about formal systems at university, but I was disappointed how they didn't seem to be used in the real word. I like the idea of being able to know that some code (object, function, ...
20
votes
4answers
1k views

Why ADTs are good and Inheritance is bad?

I am a long time OO programmer and a functional programming newbie. From my little exposure algebraic data types only look like a special case of inheritance to me where you only have one level ...
17
votes
5answers
1k views

Does java support Currying?

I was wondering if there is any way to pull that in Java. I think it is not possible without native support for closures.
14
votes
9answers
5k views

How to implement a list fold in Java

I have a List and want to reduce it to a single value (functional programming term "fold", Ruby term inject), like Arrays.asList("a", "b", "c") ... fold ... "a,b,c" As I am infected with ...
13
votes
4answers
2k views

Dynamic programming in the functional paradigm

I'm looking at Problem thirty one on Project Euler, which asks, how many different ways are there of making £2 using any number of coins of 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p). There ...
13
votes
1answer
489 views

Five Digit Primes in a 5x5 Grid

|---|---|---|---|---| | 1 | 1 | 3 | 5 | 1 | |---|---|---|---|---| | 3 | 3 | 2 | 0 | 3 | |---|---|---|---|---| | 3 | 0 | 3 | 2 | 3 | |---|---|---|---|---| | 1 | 4 | 0 | 3 | 3 | |---|---|---|---|---| | ...
11
votes
6answers
865 views

Functional programming applied

I have been interested in programming all my life and for the past 6 years I have worked almost exclusively with Java. I just finished with my University studies and have a job as a Java developer for ...
11
votes
5answers
412 views

Functional/Immutable Data Structures for the JVM?

Does anyone know of a Java/JVM data structure library providing functional (a.k.a. immutable, or "persistent" in the functional sense) equivalents of the familiar Java data structures? By ...

1 2 3 4 5 8
15 30 50 per page