siqi zhou wrote:
>
> People,
> The function defined in domain "ORESUS UnivariateSkewSeries" can't be
> applied for a generation of infinite stream?The problem made me confused
> and depressed.As follows,
> the test.spad file,
>
> )abb domain ORESUS UnivariateSkewSeries
>
> I ==> Integer
> INF ==> OrderedCompletion I
> SC ==> Stream R
>
> UnivariateSkewSeries(R:Ring, Var:Symbol, sigma:Automorphism R, delta: R ->
> R) : Exports == Implementation where
>
> Exports == Join(Ring, BiModule(R, R)) with
>
> function1: (R) -> SC
>
> Implementation == add
>
> Rep := Record(coef:SC, hi: I, lo: INF)
>
> 0 : % == [[0$R]::SC,0,0$INF]
>
> function1(s:R):SC ==
> [s for i in 1..]::SC
>
> Heap exhausted during garbage collection: 0 bytes available, 8 requested.
> Gen StaPg UbSta LaSta LUbSt Boxed Unboxed LB LUB !move Alloc Waste
> Trig WP GCs Mem-age
> 0: 0 0 0 0 0 0 0 0 0 0 0
> 2000000 0 0 0.0000
> 1: 0 0 0 0 0 0 0 0 0 0 0
> 2000000 0 0 0.0000
> ......
> for what? Yet a function defined directly in the Test.input file turns out
> all right,
>
This is difference between Spad compiler and interpreter: Spad
compiler can only produce List here (that is why Ralf got error
when he tried to say that he wants stream). Since the iteration
is infinite the list overflows memory.
In Spad you need to create stream in different way, like
(untested):
function1(s:R):SC ==
repeating([s])$SC
or more generally:
function1(s:R):SC ==
s1 : Stream(Integer) := repeating([1])
map((x: Integer) : R +-> s, s1
)$StreamFunctions2(Stream(Integer), SC)
--
Waldek Hebisch
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.