Thanks for the explanation Kari. I understand better the relationship between procedures and
functions.
Alex
> -----Original Message-----
> From: owner-oz-users@ps.uni-sb.de [mailto:owner-oz-users@ps.uni-sb.de]On
> Behalf Of Kari Pahula
> Sent: Thursday, July 17, 2003 12:17 AM
> To: users@mozart-oz.org
> Subject: Re: Function Composition
>
>
> On Wed, Jul 16, 2003 at 09:34:41PM -0700, Alex Peake wrote:
> > 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
>
> This is Mozart's way of telling you that you used a statement where an
> expression was expected.
>
> Have a look at section 6.1 in the tutorial. Essentially,
> "fun {X1 X2} E" is equivalent to "proc {X1 X2 R} R=E". Hence you try
> to force Procedure.apply to have one more argument than what it has.
> Or, arity of 3 instead of 2. As the error says.
>
> There's no benefit in using Procedure.apply either, since the arity of
> every Fn is constant, namely two.
>
> I'll leave the rest as an exercise.
> -
> 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.
-
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.