I am reading Programming Erlang, when I type these into erlang REPL:
perms([]) -> [[]];
perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])].
* 1: syntax error before: '->'
I know I cannot define functions this way in shell, so I change it to:
2> Perms = fun([]) -> [[]];(L) -> [[H|T] || H <- L, T <- Perms(L--[H])] end.
* 1: variable 'Perms' is unbound
Does this mean I cannot define a recursive function within shell?