//////////////////////
 * Copyright (c) 2007-2012, Niclas Hedhman. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied.
 * See the License for the specific language governing permissions
 * and limitations under the License.
//////////////////////

[[core-functional,Function]]
= Core Functional API =

[devstatus]
--------------
source=core/functional/dev-status.xml
--------------

The Zest™ Core Functional API is a generic package to work with Iterables in a "functional programming language" style.

This package is completely independent of everything else in Zest™ and may be used on its own in any kind of environment
such as Spring or Java EE applications.

include::../../build/docs/buildinfo/artifact.txt[]

== First Example ==
Let's say that you have an Iterable of Integers and you want to sum them all up. Most people would create a loop and
sum it all up in something like this;

[snippet,java]
-----------
source=core/functional/src/test/java/org/qi4j/functional/docsupport/FunctionalDocs.java
tag=func1
-----------

With the Zest™ Core Functional API, you go about it in a different way. The code ends up looking like this;

[snippet,java]
-----------
source=core/functional/src/test/java/org/qi4j/functional/docsupport/FunctionalDocs.java
tag=func2
-----------

And this is just the tip of the iceberg.

== The Big Picture ==

The Zest™ Core Functional API are divided a handful of powerful concepts, especially when used together;

   * *Iterables* - many methods to deal with Iterable data, so that the loops in your programs can largely be removed.

   * *Functions* - f(x) and f(x,y) are well-know from mathematics and used in functional programming languages. Zest™ is
     not capable of introducing lambda calculus due to limitations in Java itself, but we can simulate a lot to allow
     people to create more readable code.

   * *Specification* - A simple concept to define the bounds of data. This is used for filtering, query and many other
     higher level abstractions.

   * *Visitor* pattern - A way to be handed the items in a collection, without having the loops. This could be for
     end result handling, distribution of intermediary values, and many other things.


== Specification ==
TODO

== Function ==
TODO

== Visitor Pattern ==
TODO

== Iterables ==
TODO

