Saturday, May 5, 2012

Expressiveness (1)

Pieces of code that make you go "wheeeee". Today's snippet is from Joe Armstrong's "Programming Erlang" (2007), p. 54: How to generate all permutations of a list:

perms([]) -> [[]];
perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])].

No comments:

Post a Comment