[parenscript-devel] 'Do' not working as expected

Vladimir Sedach vsedach at gmail.com
Sat Jan 17 21:45:28 UTC 2009


Hi David,

You want to use 'do*' instead of 'do'. Like in CL, 'do' does loop
variable initialization in parallel, so the initial value of i is not
visible when l is being initialized to (aref blorg i). 'do*'
initializes the variables sequentially.

Vladimir

On Tue, Dec 30, 2008 at 8:46 AM, David Barker <kzar at kzar.co.uk> wrote:
> Hi Everyone,
>
> I am having some problems creating a do loop, this example:
>
> (js
>  (do ((i 0 (1+ i))
>     (l (aref blorg i) (aref blorg i)))
>    ((or (= i blorg.length)
>         (eql l "Fumitastic")))))
>
> Produces:
>
> "var _js_i1436 = 0;
> var _js_l1437 = blorg[i];
> var i = _js_i1436;
> var l = _js_l1437;
> delete _js_i1436;
> delete _js_l1437;
> for (; !(i == blorg.length || l == 'Fumitastic'); ) {
>    var _js1438 = i + 1;
>    var _js1439 = blorg[i];
>    i = _js1438;
>    l = _js1439;
> };"
>
> which doesn't work.
>
> Am I doing something wrong?
>
> Cheers, Dave.
>
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>




More information about the parenscript-devel mailing list