Two beginner questions
Peter Van Roy
pvr at info.ucl.ac.be
Fri Jan 21 20:25:00 CET 2005
The problem is the '<=' in N<=D.
The less-than-or-equal is written '=<' in Oz
(see the table on page 55 of the Oz book
or the index on page 863). You have to
write (N=<D) and then everything works!
The '<=' is an arrow symbol that is reserved
for optional arguments in method definitions.
Peter
Urban Hafner wrote:
> Torsten Anders wrote:
>
> | The error message says it all:
>
> Yes. I seems I had forgotten the then. But when I add the then I somehow
> doesn't change that much. I also added parens around the predicate which
> then results in another error message. Here's the code:
>
> declare Accum in
> local C in
> ~ C={NewCell 0}
> ~ fun {Accum N}
> ~ D=@C
> ~ in
> ~ if (N<=D) then
> C:=D+N
> ~ else
> C:=D-N
> ~ end
> ~ @C
> ~ end
> end
>
> And this is the error message:
>
> %*************************** parse error ************************
> %**
> %** expecting `)'
> %**
> %** in file "/Users/urban/blog/book/CTMCP/parse-error.oz", line 7,
> column 11
> %** ------------------ rejected (1 error)
>
> The compiler strangely thinks that right after the N a closing paren.
>
More information about the mozart-users
mailing list