Пример #1
0
 /**
  * Runs the given computation and returns its final answer.
  *
  * @param c the computation to run.
  * @return the final answer.
  */
 public IResut Run(Computation c)
 {
     return c.Apply();
 }
Пример #2
0
 /**
  * Runs the given computation with the given initial argument and returns
  * its final answer.
  *
  * @param c the computation to run.
  * @param initArg the initial argument to the computation.
  */
 public IResut Run(Computation c, Object initArg)
 {
     return c.Apply(initArg);
 }
Пример #3
0
 /**
  * Produces a <i>bind</i> (<code>&gt;&gt;=</code>) computation with the
  * given initial computation and function to produce the subsequent
  * computation.
  *
  * @param c the initial computation.
  * @param f the function to produce the subsequent computation.
  * @return a bind computation.
  */
 public abstract Computation Bind(Computation c, IComputationFactory f);
Пример #4
0
 /**
  * Produces a <i>sequence</i> (<code>&gt;&gt;</code>) computation, which
  * runs two sub-computations in sequence.
  *
  * @param c1 the first sub-computation.
  * @param c2 the second sub-computation.
  * @return a sequence computation.
  */
 public Computation Sequence(Computation c1, Computation c2)
 {
     return this.Bind(c1, new ComputationFactory(c2));
 }
Пример #5
0
 /**
  * Runs the given computation with the given initial argument and returns
  * its final answer.
  *
  * @param c the computation to run.
  * @param initArg the initial argument to the computation.
  */
 public IResut Run(Computation c, Object initArg)
 {
     return(c.Apply(initArg));
 }
Пример #6
0
 public override Computation Bind(Computation m, IComputationFactory f) {
     return new Bind(m, f);
 }
Пример #7
0
 /**
  * Runs the given computation and returns its final answer.
  *
  * @param c the computation to run.
  * @return the final answer.
  */
 public IResut Run(Computation c)
 {
     return(c.Apply());
 }
Пример #8
0
 /**
  * Produces a <i>sequence</i> (<code>&gt;&gt;</code>) computation, which
  * runs two sub-computations in sequence.
  *
  * @param c1 the first sub-computation.
  * @param c2 the second sub-computation.
  * @return a sequence computation.
  */
 public Computation Sequence(Computation c1, Computation c2)
 {
     return(this.Bind(c1, new ComputationFactory(c2)));
 }
Пример #9
0
 /**
  * Produces a <i>bind</i> (<code>&gt;&gt;=</code>) computation with the
  * given initial computation and function to produce the subsequent
  * computation.
  *
  * @param c the initial computation.
  * @param f the function to produce the subsequent computation.
  * @return a bind computation.
  */
 public abstract Computation Bind(Computation c, IComputationFactory f);
Пример #10
0
 public ComputationFactory(Computation comp)
 {
     _comp = comp;
 }
Пример #11
0
 public ComputationFactory(Computation comp)
 {
     _comp = comp;
 }