Two beginner questions

Urban Hafner urban.hafner at stud.ifi.lmu.de
Fri Jan 21 19:43:36 CET 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

| In you second example you mix up '=' with ':=': to bind a cell to a var
| just use Cell={NewCell nil}, to change to value of this cell use, e.g.,
| Cell:=1. (The variable Cell itself is still a single assignment var) .

Thanks. Yes I mixed that.

Thanks for you help,
	Urban
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB8U1YggNuVCIrEyURAoFxAJ4y6l13Y0lRMAZNgBLYqK5ksIZ4ngCfcR2w
cNKoSYO3LvoXQIvMXtnCjog=
=ecwa
-----END PGP SIGNATURE-----



More information about the mozart-users mailing list