0

The search algorithm I'm implementing (a simple partial order planner) just has a few choices to make at each invocation. Ideally I would like it to backtrack over the possibilities and return the first found solution.

logos22
  • 43
  • 1
  • 5
  • 2
    1. What is the question? 2. What have you tried? 3. What's wrong with computing the cross product and mapping the search function over the list? Laziness will take care of returning the first found solution. – crockeea Apr 04 '14 at 15:29

1 Answers1

2

Take a look at the list ([]) monad instance. It's commonly used for non-determinism.

Dan
  • 12,409
  • 3
  • 50
  • 87