/usr/share/axiom-20170501/src/algebra/BGAGG.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | )abbrev category BGAGG BagAggregate
++ Author: Michael Monagan; revised by Manuel Bronstein and Richard Jenks
++ Date Created: August 87 through August 88
++ Date Last Updated: April 1991
++ Description:
++ A bag aggregate is an aggregate for which one can insert and extract
++ objects, and where the order in which objects are inserted determines
++ the order of extraction.
++ Examples of bags are stacks, queues, and dequeues.
BagAggregate(S) : Category == SIG where
S : Type
SIG ==> HomogeneousAggregate S with
shallowlyMutable
++ shallowlyMutable means that elements of bags may be
++ destructively changed.
bag : List S -> %
++ bag([x,y,...,z]) creates a bag with elements x,y,...,z.
extract_! : % -> S
++ extract!(u) destructively removes a (random) item from bag u.
insert_! : (S,%) -> %
++ insert!(x,u) inserts item x into bag u.
inspect : % -> S
++ inspect(u) returns an (random) element from a bag.
add
bag(l) ==
x:=empty()
for s in l repeat x:=insert_!(s,x)
x
|