Is there any functional programming library for Objective-C?
A:
Objective-C is not a functional programming language (it is quite clearly procedural OO), so I don't see how there would be such a thing. If you're looking for lambdas and concurrency support, that's what Grand Central Dispatch is for in 10.6.
Chuck
2009-10-15 19:02:47
Pseudo-functional, if you like... I'm looking for something in the spirit of http://functionaljava.org/ and http://code.google.com/p/lambdaj/ for Java.
luvieere
2009-10-15 19:13:15
I take it as a compliment that the only downvotes I get are without accompanying comments.
Chuck
2009-10-17 06:02:56
Nitpick: Lambdas are not a result of GCD; they are a part of how you use GCD.Check out FunctionalKit, by the way. It is possible to write clean, mostly functional and typesafe code in Objective-C.
Jonathan Sterling
2010-05-25 20:23:06
+5
A:
You could try FunctionalKit
FunctionalKit is an attempt to use functional paradigms in Objective-C. It is a set of low level functional types & APIs. It contains types such as either, option, etc. that allow your to write correct, clean, tight, succinct and (where possible) typesafe code. It also provides more advanced concepts such as lifting functions into monads.
rebo
2009-10-16 10:21:33
It looks like this actually makes functional-style programming harder than the built-in lambdas and associated methods in 10.6 that I mentioned in my answer.
Chuck
2009-10-17 05:34:30
Try out the Blocks branch of FunctionalKit. I've also written a system to automatically wrap any operation in an Option type at runtime, which I'll be releasing soon. Blocks and runtime badassery make FunctionalKit a very useful tool, which I've used extensively in my most recent two iPhone applications.
Jonathan Sterling
2010-05-25 20:21:31