oldk1331 wrote:
> 
> My code for 'concat!' in r2591 is correct, but it runs
> incorrectly, because there is a compiler bug.
> 
> Specifically, this bug happens when there is a single "=>"
> expression inside a loop.  This bug causes the loop to only
> run once.
> 
> After some debugging, I'm not sure if this bug happens in
> "incExitLevel" in "parseIf".
> 
> Example:
> 
> )abbrev package TEST Test
> Test() : Exp == Imp where
>   Exp == with
>     test1 : List Integer -> Integer
>   Imp == add
>     test1 l ==
>       n := 0
>       while not empty? l repeat
>         -- 1+1 -- uncomment this line to workaround this bug
>         first l = 3 =>
>           n := n + 1
>           l := rest l
>       n
> 
> ===== -- should return 4 instead of 1
> (1) -> test1 [3,3,3,3]
> 
>    (1)  1

Well, clearly what compiler generates is different than "obvious"
meaning of the code.  But in general issue is somewhat tricky:
'=>' is supposed to exit current block.  In FriCAS single
instruction does _not_ form a block...  ATM I would reccomend
to use 'if' in such situations.

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/E1hs4CB-0006Mx-8B%40hera.math.uni.wroc.pl.

Reply via email to