public static Leaf Sequencer(FunctionalList <Leaf> leafList) { return(() => { if (leafList.IsEmpty) { return State.SUCCESS; } else { State headState = leafList.Head(); if (headState == State.SUCCESS) { return Sequencer(leafList.Tail)(); } else { return headState; } } }); }
public static Leaf Selector(FunctionalList <Leaf> leafList) { return(() => { if (leafList.IsEmpty) { return State.FAILURE; } else { State headState = leafList.Head(); if (headState == State.FAILURE) { return Selector(leafList.Tail)(); } else { return headState; } } }); }