|
@@ -5,7 +5,7 @@
|
|
|
-export([func/1, func/2,
|
|
|
value/1, values/1,
|
|
|
pipe/1, par/1,
|
|
|
- route/3, sync/1,
|
|
|
+ route/2, sync/1,
|
|
|
split/1, merge/1,
|
|
|
switch/1]).
|
|
|
|
|
@@ -46,17 +46,11 @@ par(Ops = [_|_]) ->
|
|
|
{In, Out} = flatten_arity(Ops),
|
|
|
#par{in=In, out=Out, ops=Ops}.
|
|
|
|
|
|
-route(N, M, Map) ->
|
|
|
- Good = lists:all(fun({Source, Target}) when Source >= 1, Source =< N,
|
|
|
- Target >= 1, Target =< M ->
|
|
|
- true;
|
|
|
- ({_Source, _Target}) ->
|
|
|
- false
|
|
|
- end,
|
|
|
- Map),
|
|
|
+route(N, Map) ->
|
|
|
+ Good = lists:all(fun(Source) -> Source > 0 andalso Source =< N end, Map),
|
|
|
case Good of
|
|
|
- true -> #route{in=N, out=M, map=Map};
|
|
|
- false -> erlang:error(badarg, [N, M, Map])
|
|
|
+ true -> #route{in=N, out=length(Map), map=Map};
|
|
|
+ false -> erlang:error(badarg, [N, Map])
|
|
|
end.
|
|
|
|
|
|
sync(N) when is_number(N) -> #sync{size=N}.
|