diff options
author | dos-reis <gdr@axiomatics.org> | 2007-08-14 05:14:52 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2007-08-14 05:14:52 +0000 |
commit | ab8cc85adde879fb963c94d15675783f2cf4b183 (patch) | |
tree | c202482327f474583b750b2c45dedfc4e4312b1d /src/algebra/ituple.spad.pamphlet | |
download | open-axiom-ab8cc85adde879fb963c94d15675783f2cf4b183.tar.gz |
Initial population.
Diffstat (limited to 'src/algebra/ituple.spad.pamphlet')
-rw-r--r-- | src/algebra/ituple.spad.pamphlet | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/src/algebra/ituple.spad.pamphlet b/src/algebra/ituple.spad.pamphlet new file mode 100644 index 00000000..84eaa8c2 --- /dev/null +++ b/src/algebra/ituple.spad.pamphlet @@ -0,0 +1,140 @@ +\documentclass{article} +\usepackage{axiom} +\begin{document} +\title{\$SPAD/src/algebra ituple.spad} +\author{Clifton J. Williamson} +\maketitle +\begin{abstract} +\end{abstract} +\eject +\tableofcontents +\eject +\section{domain ITUPLE InfiniteTuple} +<<domain ITUPLE InfiniteTuple>>= +)abbrev domain ITUPLE InfiniteTuple +++ Infinite tuples for the interpreter +++ Author: Clifton J. Williamson +++ Date Created: 16 February 1990 +++ Date Last Updated: 16 February 1990 +++ Keywords: +++ Examples: +++ References: +InfiniteTuple(S:Type): Exports == Implementation where + ++ This package implements 'infinite tuples' for the interpreter. + ++ The representation is a stream. + + Exports ==> CoercibleTo OutputForm with + map: (S -> S, %) -> % + ++ map(f,t) replaces the tuple t + ++ by \spad{[f(x) for x in t]}. + filterWhile: (S -> Boolean, %) -> % + ++ filterWhile(p,t) returns \spad{[x for x in t while p(x)]}. + filterUntil: (S -> Boolean, %) -> % + ++ filterUntil(p,t) returns \spad{[x for x in t while not p(x)]}. + select: (S -> Boolean, %) -> % + ++ select(p,t) returns \spad{[x for x in t | p(x)]}. + generate: (S -> S,S) -> % + ++ generate(f,s) returns \spad{[s,f(s),f(f(s)),...]}. + construct: % -> Stream S + ++ construct(t) converts an infinite tuple to a stream. + + Implementation ==> Stream S add + generate(f,x) == generate(f,x)$Stream(S) pretend % + filterWhile(f, x) == filterWhile(f,x pretend Stream(S))$Stream(S) pretend % + filterUntil(f, x) == filterUntil(f,x pretend Stream(S))$Stream(S) pretend % + select(f, x) == select(f,x pretend Stream(S))$Stream(S) pretend % + construct x == x pretend Stream(S) +-- coerce x == +-- coerce(x)$Stream(S) + +@ +\section{package ITFUN2 InfiniteTupleFunctions2} +<<package ITFUN2 InfiniteTupleFunctions2>>= +)abbrev package ITFUN2 InfiniteTupleFunctions2 +InfiniteTupleFunctions2(A:Type,B:Type): Exports == Implementation where + ++ Functions defined on streams with entries in two sets. + IT ==> InfiniteTuple + + Exports ==> with + map: ((A -> B),IT A) -> IT B + ++ \spad{map(f,[x0,x1,x2,...])} returns \spad{[f(x0),f(x1),f(x2),..]}. + + Implementation ==> add + + map(f,x) == + map(f,x pretend Stream(A))$StreamFunctions2(A,B) pretend IT(B) + +@ +\section{package ITFUN3 InfiniteTupleFunctions3} +<<package ITFUN3 InfiniteTupleFunctions3>>= +)abbrev package ITFUN3 InfiniteTupleFunctions3 +InfiniteTupleFunctions3(A:Type, B:Type,C:Type): Exports + == Implementation where + ++ Functions defined on streams with entries in two sets. + IT ==> InfiniteTuple + ST ==> Stream + SF3 ==> StreamFunctions3(A,B,C) + FUN ==> ((A,B)->C) + Exports ==> with + map: (((A,B)->C), IT A, IT B) -> IT C + ++ map(f,a,b) \undocumented + map: (((A,B)->C), ST A, IT B) -> ST C + ++ map(f,a,b) \undocumented + map: (((A,B)->C), IT A, ST B) -> ST C + ++ map(f,a,b) \undocumented + + Implementation ==> add + + map(f:FUN, s1:IT A, s2:IT B):IT C == + map(f, s1 pretend Stream(A), s2 pretend Stream(B))$SF3 pretend IT(C) + map(f:FUN, s1:ST A, s2:IT B):ST C == + map(f, s1, s2 pretend Stream(B))$SF3 + map(f:FUN, s1:IT A, s2:ST B):ST C == + map(f, s1 pretend Stream(A), s2)$SF3 + +@ +\section{License} +<<license>>= +--Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. +--All rights reserved. +-- +--Redistribution and use in source and binary forms, with or without +--modification, are permitted provided that the following conditions are +--met: +-- +-- - Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- +-- - Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in +-- the documentation and/or other materials provided with the +-- distribution. +-- +-- - Neither the name of The Numerical ALgorithms Group Ltd. nor the +-- names of its contributors may be used to endorse or promote products +-- derived from this software without specific prior written permission. +-- +--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +--IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +--TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +--PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +--OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +--EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +--PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +--PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +--LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +--NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +--SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +@ +<<*>>= +<<license>> + +<<domain ITUPLE InfiniteTuple>> +<<package ITFUN2 InfiniteTupleFunctions2>> +<<package ITFUN3 InfiniteTupleFunctions3>> +@ +\eject +\begin{thebibliography}{99} +\bibitem{1} nothing +\end{thebibliography} +\end{document} |