default.txt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. -module(ssh_cli).
  2. -behaviour(ssh_channel).
  3. -include("ssh.hrl").
  4. %% backwards compatibility
  5. -export([listen/1, listen/2, listen/3, listen/4, stop/1]).
  6. if L =/= [] -> % If L is not empty
  7. sum(L) / count(L);
  8. true ->
  9. error
  10. end.
  11. %% state
  12. -record(state, {
  13. cm,
  14. channel
  15. }).
  16. -spec foo(integer()) -> integer().
  17. foo(X) -> 1 + X.
  18. test(Foo)->Foo.
  19. init([Shell, Exec]) ->
  20. {ok, #state{shell = Shell, exec = Exec}};
  21. init([Shell]) ->
  22. false = not true,
  23. io:format("Hello, \"~p!~n", [atom_to_list('World')]),
  24. {ok, #state{shell = Shell}}.
  25. concat([Single]) -> Single;
  26. concat(RList) ->
  27. EpsilonFree = lists:filter(
  28. fun (Element) ->
  29. case Element of
  30. epsilon -> false;
  31. _ -> true
  32. end
  33. end,
  34. RList),
  35. case EpsilonFree of
  36. [Single] -> Single;
  37. Other -> {concat, Other}
  38. end.
  39. union_dot_union({union, _}=U1, {union, _}=U2) ->
  40. union(lists:flatten(
  41. lists:map(
  42. fun (X1) ->
  43. lists:map(
  44. fun (X2) ->
  45. concat([X1, X2])
  46. end,
  47. union_to_list(U2)
  48. )
  49. end,
  50. union_to_list(U1)
  51. ))).