First-class functions: Difference between revisions

Content added Content deleted
(→‎{{header|Nemerle}}: Added a Mercury implementation.)
m (→‎firstclass.m: Corrected composition order.)
Line 892: Line 892:
apply([], A, Results) :- Results = A.
apply([], A, Results) :- Results = A.
apply([F, R|Functions], A, Results) :-
apply([F, R|Functions], A, Results) :-
apply(Functions, [compose(F, R, 0.5) | A], Results).
apply(Functions, [compose(R, F, 0.5) | A], Results).
apply([_], _, _) :- throw("This can't happen!").</lang>
apply([_], _, _) :- throw("This can't happen!").</lang>