Dear Roger,

The error variable MaxOfThree not introduced simply means you need to declare the variable first. For a global variable in the OPI you need a preceeding 'declare' as in the following

declare
fun {Max X Y}
   if X>Y then X
   else Y
   end
end
fun {MaxOfThree X Y Z}
   {Max X {Max Y Z}}
end


Best
Torsten

On 14 Apr 2009, at 15:08, Roger Mason wrote:

Hello,

I'm trying mozart for the first time. When I send the following to the
compiler, some work, some don't:

{Browse 'Hello World!'}
works.

fun {Max X Y}
   if X>Y then X
   else Y
   end
end

{Browse {Max 3 5}}
works.

fun {MaxOfThree X Y Z}
   {Max X {Max Y Z}}
end

Fails:

%********************* binding analysis error *******************
%**
%** variable MaxOfThree not introduced
%**
%** in file "Oz", line 11, column 5
%** ------------------ rejected (1 error)

I got the two functions from
http://www.ling.gu.se/~lager/kurser/ExploringOz/Exercises/Solutions/ maxOfThree.htm.

I have no clue what I'm doing wrong.

Thanks for any help,

Roger Mason
______________________________________________________________________ ___________ mozart-users mailing list mozart- [email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

--
Torsten Anders
Interdisciplinary Centre for Computer Music Research
University of Plymouth
Office: +44-1752-586219
Private: +44-1752-558917
http://strasheela.sourceforge.net
http://www.torsten-anders.de



_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to