Higher Order Function Question

Alex Peake <>
Thu May 16 06:19:21 CEST 2002

I have a function that in Lisp is defined:

%(defun disjoin (fn &rest fns)
%  (if (null fns)
%      fn
%      (let ((disj (apply #'disjoin fns)))
%        #'(lambda (&rest args)
%            (or (apply fn args) (apply disj args))))))

or in Scheme:

%(define (disjoin fn . fns)
%    (if (null? fns)
%        fn
%        (lambda (args)
%          (or (fn args) ((apply disjoin fns) args)))))

I have tried the following (incorrect) Erlang:

disjoin([Fn | FnTail]) ->
	fun(Args) ->
		apply(Fn, [Args]) orelse apply(apply(disjoin, [FnTail]), [Args]) end;
disjoin([Fn]) ->

Can anyone help please?


More information about the erlang-questions mailing list