diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/algebra/aggcat.spad.pamphlet | 14 | ||||
-rw-r--r-- | src/algebra/list.spad.pamphlet | 7 |
3 files changed, 20 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6325a19b..c248e635 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-05-21 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * algebra/aggcat.spad.pamphlet (UnaryRecursiveAggregate) [map!]: + Implement default. + * algebra/list.spad.pamphlet (List) [map!]: Likewise. + 2013-05-20 Gabriel Dos Reis <gdr@integrable-solutions.net> * interp/database.boot (getConstructorAbbreviationFromDB): Use DB diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet index 2dd2fc74..512bf628 100644 --- a/src/algebra/aggcat.spad.pamphlet +++ b/src/algebra/aggcat.spad.pamphlet @@ -1662,6 +1662,13 @@ UnaryRecursiveAggregate(S:Type): Category == RecursiveAggregate S with setrest!(x, empty()) y + map!(f,x) == + y := x + while not empty? y repeat + setfirst!(y,f first y) + y := rest y + x + @ \section{category STAGG StreamAggregate} @@ -1735,13 +1742,6 @@ StreamAggregate(S:Type): Category == empty? l => empty() concat!(copy first l, concat rest l) - map!(f, l) == - y := l - while not empty? l repeat - setfirst!(l, f first l) - l := rest l - y - fill!(x, s) == y := x while not empty? y repeat (setfirst!(y, s); y := rest y) diff --git a/src/algebra/list.spad.pamphlet b/src/algebra/list.spad.pamphlet index 6ceb30fa..2bf3a01d 100644 --- a/src/algebra/list.spad.pamphlet +++ b/src/algebra/list.spad.pamphlet @@ -253,6 +253,13 @@ List(S:Type): Exports == Implementation where convert concat(convert('construct)@InputForm, [convert a for a in (x pretend List S)]$List(InputForm)) + map!(f,x) == + y := x + while not empty? y repeat + y.first := f(y.first) + y := rest y + x + @ \section{package LIST2 ListFunctions2} |