I wonder if an increase in usable (not advertised) context tokens may obviate many of these approaches.
There is an open source (LGPL) Community Edition, but the services & actions feature you need for this is only available in the Professional Edition. This being said, if you just need this for your own local testing, you can get a trial license (automatic process, valid 3 months, no limit on number of licenses you get), and have fun with it.
Bias: I'm one of the Orbeon Forms developers ;). ‑Alex
map f: (a->b)->(x->b->x)->(x->a->x)
filter pred: (a->bool)->(x->a->x)->(x->a->x)
flatmap f: (a->[b])->(x->b->x)->(x->a->x)
etc.
For clarity, let's define a type alias for reducers:
type Reducer[X, A] = (X, A) ⇒ X
Let's define `map` to match the type definition you provided. And with that type definition, I only see one way in which the function can be implemented. So it must be: def map[X, A, B](f: A ⇒ B): (Reducer[X, B] ⇒ Reducer[X, A]) =
(redB: Reducer[X, B]) ⇒ (x: X, a: A) ⇒ redB(x, f(a))
How can I use this? Let's try the following: def addup(zero: Int, a: List[Int]) = a.foldLeft(zero)(_ + _)
def parseList(a: List[String]) = a.map(_.toInt)
map(parseList)(addup)(1, List("7", "8"))
This returns 16. OK, parsing the list, and adding up starting from 1. But it doesn't look to me like `map` implements anything like the usual semantic of map. It just converts the data structure, and applies the reducer. What am I missing here?
> hear not found
macOS 15.1