Lazy recursive list comprehensions

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Fri Jan 13 13:30:25 CET 2006


I think that the conversion of trans to not using comprehensions is

trans({st, _, []}) ->
     [{[], 0}];
trans(S) ->
    Fun = fun({S1, M1, C1}) ->
		  lists:map(fun({M2, C2}) ->
				{[M1|M2], C1+C2}
			    end,
			    trans(S1))
	  end,
    lists:flatmap(Fun, move(S)).

At least, this returns the same result for zurg:solution() :-)

/Vlad



More information about the erlang-questions mailing list