Illegal arity in application error

Juergen Stuber juergen at jstuber.net
Thu Feb 8 08:08:05 CET 2007


Hi Craig,

Craig Ugoretz <craigugoretz at gmail.com> wrote:
> 
> declare
> fun {ApplyMoves S Ms}
> end
> {ApplyMoves 0 [one(1) two(~1)]}

you have to use the value your function returns,
otherwise it is syntactically a predicate,
and has one extra argument for the return value.
E.g.

{Browse {ApplyMoves 0 [one(1) two(~1)]}}

should work.  It is equivalent to the following using predicate syntax

local Result in
   {ApplyMoves 0 [one(1) two(~1)] Result}
   {Browse Result}
end

Predicates are also the internal representation,
which explains the arity 3 in the error message:

> %********************** 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


Hope this helps

Jürgen

-- 
Jürgen Stuber <juergen at jstuber.net>
http://www.jstuber.net/
gnupg key fingerprint = 2767 CA3C 5680 58BA 9A91  23D9 BED6 9A7A AF9E 68B4


More information about the mozart-users mailing list