[bitc-dev] first try with bitc

Tom Bachmann e_mc_h2 at web.de
Wed May 24 12:47:31 EDT 2006


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

Swaroop Sridhar wrote:
> Now, the code:
> [...]
> works OK.

I can confirm this.

> Of course, it will only print `foo' rather than the contents
> of the vector because of the way it is written.

I tried to change that. The code now looks like

(bitc-version "0.9+")
(import stdio bitc.stdio)

(define (main argv:(vector string))
  (letrec
    ((print (lambda (s)
              (stdio.write-string stdio.stdout s)
              (stdio.write-char stdio.stdout #\linefeed)))
     (iter (lambda (f v i)
             (if (== i (vector-length v))
               ()
               (begin
                 (f (vector-nth v i))
                 (iter f v (+ i 1))))))
     (vector-for-each (lambda (f v)
                        (iter f v 0))))
    (vector-for-each print argv))
  (the int32 0))

But bitcc complains:

echo2.bitc:9:6: Function iter Needs Closure Conversion. [Heap Closure].
        Free Variables are: iter,   Bound Variables are: f, v, i,
echo2.bitc:15:6: Function vector-for-each Needs Closure Conversion.
[Heap Closure].
        Free Variables are: iter,   Bound Variables are: f, v,
Exiting due to errors during Closure Conversion

I do not understand what this means, though.
- --
- -ness-
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEdI4jvD/ijq9JWhsRAuusAJ4qZ5Zn68y3mzM05MtpF2SIerSvKACePcXd
9QB/NX2Y7CihhoRdiwfcR1s=
=12yu
-----END PGP SIGNATURE-----


More information about the bitc-dev mailing list