aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/seg.spad.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-10-29 01:11:57 +0000
committerdos-reis <gdr@axiomatics.org>2009-10-29 01:11:57 +0000
commit402e10d38c81689647ae1004c80acb9841798e9b (patch)
treee20e4a1cf9db9366da261d4358f15956efa770d3 /src/algebra/seg.spad.pamphlet
parente5585b7d274f667c8439e98d6b5030303d13e319 (diff)
downloadopen-axiom-402e10d38c81689647ae1004c80acb9841798e9b.tar.gz
* algebra/seg.spad.pamphlet (RangeBinding): New.
(SegmentBinding): Tidy. * algebra/exposed.lsp.pamphlet (RangeBinding): Expose. * algebra/Makefile.pamphlet (axiom_algebra_layer_19): Include RNGBIND.
Diffstat (limited to 'src/algebra/seg.spad.pamphlet')
-rw-r--r--src/algebra/seg.spad.pamphlet78
1 files changed, 50 insertions, 28 deletions
diff --git a/src/algebra/seg.spad.pamphlet b/src/algebra/seg.spad.pamphlet
index b75f8e92..19a475a4 100644
--- a/src/algebra/seg.spad.pamphlet
+++ b/src/algebra/seg.spad.pamphlet
@@ -237,6 +237,52 @@ SegmentFunctions2(R:Type, S:Type): public == private where
@
+\section{General Range Binding}
+
+<<domain RNGBIND RangeBinding>>=
+)abbrev domain RNGBIND RangeBinding
+++ Author: Gabriel Dos Reis
+++ Date Created: October 29, 2009
+++ Date Last Updated: October 29, 2009
+++ Related Constructors: SegmentCategory, SegmentBinding
+++ Description:
+++ This domain represents the notion of binding a variable to range
+++ over a specific segment (either bounded, or half bounded).
+RangeBinding(S, T): Public == Private where
+ T: Type
+ S: SegmentCategory T
+ Public == Type with
+ equation: (Symbol, S) -> %
+ ++ \spad{equation(v,s)} creates a segment binding value with variable
+ ++ \spad{v} and segment \spad{s}. Note that the interpreter parses
+ ++ \spad{v=s} to this form.
+ variable: % -> Symbol
+ ++ \spad{variable(x)} returns the variable from the left hand side of
+ ++ the \spadtype{RangeBinding}. For example, if \spad{x} is
+ ++ \spad{v=s}, then \spad{variable(x)} returns \spad{v}.
+ segment: % -> S
+ ++ \spad{segment(x)} returns the segment from the right hand side of
+ ++ the \spadtype{RangeBinding}. For example, if \spad{x} is
+ ++ \spad{v=s}, then \spad{segment(x)} returns \spad{s}.
+
+ if S has SetCategory then SetCategory
+
+ Private == add
+ Rep == Record(var: Symbol, seg: S)
+ equation(v,s) == per [v,s]
+ variable x == rep(x).var
+ segment x == rep(x).seg
+
+ if S has SetCategory then
+ x = y ==
+ variable x = variable y and segment x = segment y
+
+ coerce(x: %): OutputForm ==
+ variable(x)::OutputForm = segment(x)::OutputForm
+
+@
+
+
\section{domain SEGBIND SegmentBinding}
<<domain SEGBIND SegmentBinding>>=
@@ -257,34 +303,7 @@ import Segement
++ Description:
++ This domain is used to provide the function argument syntax \spad{v=a..b}.
++ This is used, for example, by the top-level \spadfun{draw} functions.
-SegmentBinding(S:Type): Type with
- equation: (Symbol, Segment S) -> %
- ++ equation(v,a..b) creates a segment binding value with variable
- ++ \spad{v} and segment \spad{a..b}. Note that the interpreter parses
- ++ \spad{v=a..b} to this form.
- variable: % -> Symbol
- ++ variable(segb) returns the variable from the left hand side of
- ++ the \spadtype{SegmentBinding}. For example, if \spad{segb} is
- ++ \spad{v=a..b}, then \spad{variable(segb)} returns \spad{v}.
- segment : % -> Segment S
- ++ segment(segb) returns the segment from the right hand side of
- ++ the \spadtype{SegmentBinding}. For example, if \spad{segb} is
- ++ \spad{v=a..b}, then \spad{segment(segb)} returns \spad{a..b}.
-
- if S has SetCategory then SetCategory
- == add
- Rep := Record(var:Symbol, seg:Segment S)
- equation(x,s) == [x, s]
- variable b == b.var
- segment b == b.seg
-
- if S has SetCategory then
-
- b1 = b2 == variable b1 = variable b2 and segment b1 = segment b2
-
- coerce(b:%):OutputForm ==
- variable(b)::OutputForm = segment(b)::OutputForm
-
+SegmentBinding(S:Type) == RangeBinding(Segment S, S)
@
\section{package SEGBIND2 SegmentBindingFunctions2}
@@ -528,6 +547,8 @@ IncrementingMaps(R:Join(Monoid, AbelianSemiGroup)): with
<<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
@@ -562,6 +583,7 @@ IncrementingMaps(R:Join(Monoid, AbelianSemiGroup)): with
<<category SEGCAT SegmentCategory>>
<<category SEGXCAT SegmentExpansionCategory>>
+<<domain RNGBIND RangeBinding>>
<<domain SEG Segment>>
<<package SEG2 SegmentFunctions2>>
<<domain SEGBIND SegmentBinding>>