/usr/share/axiom-20170501/src/algebra/STREAM3.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 38 39 40 | )abbrev package STREAM3 StreamFunctions3
++ Authors: Burge, Watt; updated by Clifton J. Williamson
++ Date Created: July 1986
++ Date Last Updated: 29 January 1990
++ Description:
++ Functions defined on streams with entries in three sets.
StreamFunctions3(A,B,C) : SIG == CODE where
A : Type
B : Type
C : Type
ST ==> Stream
SIG ==> with
map : ((A,B) -> C,ST A,ST B) -> ST C
++ map(f,st1,st2) returns the stream whose elements are the
++ function f applied to the corresponding elements of st1 and st2.
++ \spad{map(f,[x0,x1,x2,..],[y0,y1,y2,..]) = [f(x0,y0),f(x1,y1),..]}.
++
++S
++X m:=[i for i in 1..]::Stream(Integer)
++X n:=[i for i in 1..]::Stream(Integer)
++X f(i:Integer,j:Integer):Integer == i+j
++X map(f,m,n)
CODE ==> add
mapp:((A,B) -> C,ST A,ST B) -> ST C
mapp(g,x,y) == delay
empty? x or empty? y => empty()
concat(g(frst x,frst y), map(g,rst x,rst y))
map(g,x,y) ==
explicitlyEmpty? x => empty()
eq?(x,rst x) => map(z +-> g(frst x,z),y)$StreamFunctions2(B,C)
explicitlyEmpty? y => empty()
eq?(y,rst y) => map(z +-> g(z,frst y),x)$StreamFunctions2(A,C)
mapp(g,x,y)
|