views:

302

answers:

2

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
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
I take it as a compliment that the only downvotes I get are without accompanying comments.
Chuck
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
+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.

FunctionalKit

rebo
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
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