Example #1
0
 /**
  * Maps the given function across the list of results and returns a list
  * consisting of the flattened contents of all the generated lists of
  * results.
  *
  * @param f the function to map across the list of results.
  */
 internal List MapAppend(IComputationFactory f)
 {
     var result = new ArrayList();
     foreach (var o in list)
     {
         var ri = (List)f.Make(o).Apply();
         result.AddRange(ri.list);
     }
     return new List(result);
 }
Example #2
0
        /**
         * Maps the given function across the list of results and returns a list
         * consisting of the flattened contents of all the generated lists of
         * results.
         *
         * @param f the function to map across the list of results.
         */
        internal List MapAppend(IComputationFactory f)
        {
            var result = new ArrayList();

            foreach (var o in list)
            {
                var ri = (List)f.Make(o).Apply();
                result.AddRange(ri.list);
            }
            return(new List(result));
        }
Example #3
0
        /**
         * Applies the bind computation to the given state.
         *
         * @param state the current contents of the state.
         * @return the result of applying the bind computation.
         */
        public override IResut Apply(Object state)
        {
            var a1 = (Pair)this.c.Apply(state);

            return(f.Make(a1.Value()).Apply(a1.State()));
        }