Permutations: Difference between revisions
Content deleted Content added
→{{header|Erlang}}: Get rid of ++ append operation in zipper |
→{{header|Erlang}}: fix shell code |
||
Line 898: | Line 898: | ||
Y-combinator (for shell): |
Y-combinator (for shell): |
||
<lang Erlang> |
<lang Erlang> |
||
F = fun(L) -> G = fun(_, []) -> [[]]; (F, L) -> [[X|Y] || X<-L, Y<-F(F, L--X)] end, G(G, L) end. |
F = fun(L) -> G = fun(_, []) -> [[]]; (F, L) -> [[X|Y] || X<-L, Y<-F(F, L--[X])] end, G(G, L) end. |
||
</lang> |
</lang> |
||
More efficient zipper implementation: |
More efficient zipper implementation: |