|
|
|
|
|
by hhandoko
3349 days ago
|
|
> Functional programming has nothing to do with declarative/imperative programming styles. > The "functional" part determines the architecture by which the code is structured opposed to the style (vanity) by which the structure comes together. I think it means a code can be functional but looks imperative. One example is the for-comprehension in Scala: val aFuture = future(a)
val bFuture = future(b)
(for {
a <- aFuture
b <- bFuture
c <- futureC(a, b)
} yield c)
This is just a contrived example for working with `Future[T]`, but it can be applied to other monadic types.For an example library that can be used with a few different styles, have a look at this: http://jsuereth.com/scala-arm/usage.html |
|