Illegal arity in application error
Craig Ugoretz
craigugoretz at gmail.com
Thu Feb 8 04:19:12 CET 2007
Hello,
I am trying to work assignment one, "train shunting" from CS2104 course
notes presented on the supplements website for the Van Roy and Haridi book
to help me learn the Oz language. I don't understand why I get a compile
error for my code (a simplification of the assignment one problem) since the
function ApplyMoves clearly has just two arguments. The error, of course,
says that it takes three? When I compile just the function, not the call to
the function, I don't get an error.
Craig
declare
fun {ApplyMoves S Ms}
%% S is the state, Ms the list of moves to be applied
%% Returns list of resulting states
case Ms
of nil then S
[] M|Mr then
%% Compute S1 as new state
S1 = case M
of one(N) then
if N>0 then 1 else 2 end
[] two(N) then
if N>0 then 3 else 4 end
end
in
S#{ApplyMoves S1 Mr}
end
end
{ApplyMoves 0 [one(1) two(~1)]}
%********************** static analysis error *******************
%**
%** illegal arity in application
%**
%** Arity found: 2
%** Expected: 3
%** Application (names): {ApplyMoves _ _}
%** Application (values): {<P/3> 0 nil}
%** in file "c:/Documents and Settings/Compaq_Owner/Desktop/ApplyMoves2.oz",
line 20, column 0
%** ------------------ rejected (1 error)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gforge.info.ucl.ac.be/pipermail/mozart-users/attachments/20070207/b259f158/attachment.html
More information about the mozart-users
mailing list