diff options
author | dos-reis <gdr@axiomatics.org> | 2009-02-18 15:37:25 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2009-02-18 15:37:25 +0000 |
commit | f04f6bff2bb92b851b5aef56c6846fd01b493d7d (patch) | |
tree | c6a1e58944d528c6e4671d891d7dcf4c9804ed7c /src/algebra/aggcat2.spad.pamphlet | |
parent | 54c2b07353f228554b92269a9a4e688683ae85d6 (diff) | |
download | open-axiom-f04f6bff2bb92b851b5aef56c6846fd01b493d7d.tar.gz |
* interp/parse.boot (parseHas): Constants are not attributes.
* interp/compiler.boot (compHasFormat): Handle signature for
constants too.
* interp/info.boot (actOnInfo): Likewise.
* algebra/data.spad.pamphlet (sample$Byte): Make a constant.
(SystemInteger): Export constant 'sample'.
(SystemNonNegativeInteger): Likewise.
* algebra/aggcat2.spad.pamphlet (FiniteLinearAggregateFunctions2):
Use 'sample' or 'random' elements when allocating new aggregates.
Diffstat (limited to 'src/algebra/aggcat2.spad.pamphlet')
-rw-r--r-- | src/algebra/aggcat2.spad.pamphlet | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/algebra/aggcat2.spad.pamphlet b/src/algebra/aggcat2.spad.pamphlet index a49e955d..7fea65b4 100644 --- a/src/algebra/aggcat2.spad.pamphlet +++ b/src/algebra/aggcat2.spad.pamphlet @@ -56,6 +56,11 @@ FiniteLinearAggregateFunctions2(S, A, R, B): ++ \spad{[reduce(f,[a1],r),reduce(f,[a1,a2],r),...]}. Implementation ==> add + getRSample(): R == + R has sample: R => sample()$R + R has random: () -> R => random()$R + NIL$Lisp -- R got to be non-trivial. + if A has ListAggregate(S) then -- A is a list-oid reduce(fn, l, ident) == empty? l => ident @@ -72,12 +77,12 @@ FiniteLinearAggregateFunctions2(S, A, R, B): else -- A is a list-oid, B a mutable array-oid map(f, l) == - i := minIndex(w := new(#l,NIL$Lisp)$B) + i := minIndex(w := new(#l,getRSample())$B) for a in entries l repeat (qsetelt_!(w, i, f a); i := inc i) w scan(fn, l, ident) == - i := minIndex(w := new(#l,NIL$Lisp)$B) + i := minIndex(w := new(#l,getRSample())$B) vl := ident for a in entries l repeat vl := qsetelt_!(w, i, fn(a, vl)) @@ -105,13 +110,13 @@ FiniteLinearAggregateFunctions2(S, A, R, B): else -- A and B are array-oid's if B has shallowlyMutable then -- B is also mutable map(f, v) == - w := new(#v,NIL$Lisp)$B + w := new(#v,getRSample())$B for i in minIndex w .. maxIndex w repeat qsetelt_!(w, i, f qelt(v, i)) w scan(fn, v, ident) == - w := new(#v,NIL$Lisp)$B + w := new(#v,getRSample())$B vl := ident for i in minIndex v .. maxIndex v repeat vl := qsetelt_!(w, i, fn(qelt(v, i), vl)) @@ -188,6 +193,8 @@ FiniteSetAggregateFunctions2(S, A, R, B): Exports == Implementation where <<license>>= --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. --All rights reserved. +--Copyright (C) 2007-2009, Gabriel Dos Reis. +--All rights reserved. -- --Redistribution and use in source and binary forms, with or without --modification, are permitted provided that the following conditions are |