c# - Lambda returning another lambda -


Is there any way to return lambda from the second lambda?

What I want to do is the finite state machine, which is applied as Lambda, which implies another state (or zero) to Lambda.

Nesting Funk & lt;> will not work as I want

C #, .NET 3.5

Example:

Machine , 3 states, pseudolanguage

  Private Lemba state 1 () {if (some condition IMS) returns state 2; Back state 1; } Private Lambda State 2 () {While (some condition IMS) Return State 2; Back to state 3; } Private Lambda State 3 () {Logand (); Return tap; } Public Zero (FSM) {lambda _currentState = State1; While (_currentState! = NULL) {_currentState = _currentState (); }}  

I know, for example, I can do this work using enum + switch, but if I can do it I am curious.

I believe you can declare a representative type: public representative Lambda Lambda () which gives a representative of its own type. It compiles, anyway.


Comments