Oz and Mozart Users Mailing List

Function Composition


From: Alex Peake (apeake@comac.com)
Date: Thu Jul 17 2003 - 06:34:41 CEST


Can someone help please?

I am learning Oz. I am trying to implement function composition, but cannot get it.

I try:

declare
fun {Compose Fns}
   case Fns of
      [Fn] then Fn
   [] Fn|FnTail then
      fun {$ Args}
         {Procedure.apply Fn {Procedure.apply {Compose FnTail} Args}}
      end
   end
end

But alas, it will not compile, and I do not understand the error.

%********************** static analysis error *******************
%**
%** illegal arity in application
%**
%** Arity found: 3
%** Expected: 2
%** Argument names: {Procedure.apply _ Args _}
%** Argument values: {<P/2 Procedure.apply> _<optimized> Args<optimized> _<optimized>}
%** in file "C:/Test/Experiment.Oz", line 57, column 22

%********************** static analysis error *******************
%**
%** illegal arity in application
%**
%** Arity found: 3
%** Expected: 2
%** Argument names: {Procedure.apply Fn _ _}
%** Argument values: {<P/2 Procedure.apply> Fn<optimized> _<optimized> _<optimized>}
%** in file "C:/Test/Experiment.Oz", line 57, column 2
%** ------------------ rejected (2 errors)

Alex
-
Please send submissions to users@mozart-oz.org
and administriva mail to users-request@mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.
Please send bug reports to bugs@mozart-oz.org.



This archive was generated by hypermail 2b29.