Higher Order Function Question
Thomas Arts
thomas@REDACTED
Thu May 16 09:12:45 CEST 2002
Hi Alex
> disjoin([Fn | FnTail]) ->
> fun(Args) ->
> apply(Fn, [Args]) orelse apply(apply(disjoin, [FnTail]), [Args]) end;
> disjoin([Fn]) ->
> Fn.
>
> Can anyone help please?
turn around the first and second clause. The first clause
also matches disjoint([F]), since in that case FnTail is
nil.
/Thomas
ps. You don't need to use three apply's, I guess you want to
recursively apply disjoin on the rest of the functions:
fun(Args) ->
apply(Fn, [Args]) orelse
apply(apply(disjoin, [FnTail]), [Args])
end;
is equal to:
fun(Args) ->
apply(Fn,[Args]) orelse
apply(disjoin(FnTail),[Args])
end;
More information about the erlang-questions
mailing list