axiom-mail
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-mail] if then followed by for


From: Gregory Vanuxem
Subject: [Axiom-mail] if then followed by for
Date: Sun, 03 Aug 2008 16:32:53 +0200

Hello,

Here is a simple piece of code:
----------------------------------------------
)abb package FOO Foo
Foo(R,VCR): Exports == Implementation where
  R   : FloatingPointSystem
  VCR : VectorCategory R
  Exports == with
    bar : (Boolean, VCR) -> Integer
    ++ bar(b,v)
  Implementation == add
    import OutputPackage
    bar(b, v) ==
      if b then
        --output("")
        for i in minIndex v..maxIndex v repeat
          if v.i <= 0 then return -1
      else
        for i in minIndex v ..maxIndex v repeat
          v.i := 1
      output(v::OutputForm)
      0
------------------------------------------------

why if I run:

v:=new(5,0)$Vector(SF)
bar(false,v)

[0.0,0.0,0.0,0.0,0.0] is printed

but if I uncomment 'output("")'

[1.0,1.0,1.0,1.0,1.0] is printed as expected ?

Where am I wrong ? Looks like a bug, no ?

Greg







reply via email to

[Prev in Thread] Current Thread [Next in Thread]