From 2d549b2820656d352a8f57f1157580b1500ec89a Mon Sep 17 00:00:00 2001
From: Nicolas Voirol <voirol.nicolas@gmail.com>
Date: Mon, 4 May 2015 15:37:24 +0200
Subject: [PATCH] Added some doc for HOFs

---
 doc/purescala.rst | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/doc/purescala.rst b/doc/purescala.rst
index 7c9f7e6ce..004d37a13 100644
--- a/doc/purescala.rst
+++ b/doc/purescala.rst
@@ -299,6 +299,25 @@ Map
  m.updated(index, value)
 
 
+Function
+########
+
+.. code-block:: scala
+
+ val f1 = (x: Int) => x + 1                 // simple anonymous function
+
+ val y  = 2
+ val f2 = (x: Int) => f1(x) + y             // closes over `f1` and `y`
+ val f3 = (x: Int) => if (x < 0) f1 else f2 // anonymous function returning another function
+
+ list.map(f1)      // functions can be passed around ...
+ list.map(f3(1) _) // ... and partially applied
+
+.. note::
+ No operators are defined on function-typed expressions, so specification is
+ currently quite limited.
+
+
 Symbolic Input-Output examples
 ------------------------------
 
-- 
GitLab