I completely forgot to ask:
can I commit this one?
Index: mkfunc.spad.pamphlet
===================================================================
--- mkfunc.spad.pamphlet (revision 419)
+++ mkfunc.spad.pamphlet (working copy)
@@ -209,6 +209,8 @@
InputFormFunctions1(R:Type):with
packageCall : Symbol -> InputForm
++ packageCall(f) returns the input form corresponding to f$R.
+ packageCall : (Symbol, List InputForm) -> InputForm
+ ++ packageCall(f, l) returns the input form corresponding to f(l)$R.
coerceToType : InputForm -> InputForm
++ coerceToType(f) returns the input form corresponding to f::R
atType: InputForm -> InputForm
@@ -230,6 +232,10 @@
convert([convert("$elt"::Symbol), Rname,
convert name]$List(InputForm))@InputForm
+ packageCall(name, args) ==
+ convert cons(packageCall name, args)
+
+
coerceToType form == convert([convert("::"::Symbol), form,
Rname]$List(InputForm))@InputForm
Index: seg.spad.pamphlet
===================================================================
--- seg.spad.pamphlet (revision 419)
+++ seg.spad.pamphlet (working copy)
@@ -53,6 +53,8 @@
convert: S -> %
++ convert(i) creates the segment \spad{i..i}.
+ if S has ConvertibleTo InputForm then ConvertibleTo InputForm
+
@
\section{category SEGXCAT SegmentExpansionCategory}
<<category SEGXCAT SegmentExpansionCategory>>=
@@ -128,8 +130,21 @@
s.incr = 1 => seg
infix(" by "::OutputForm, seg, s.incr::OutputForm)
- convert a == [a,a,1]
+ convert(a: S): % == [a,a,1]
+ if S has ConvertibleTo InputForm then
+ INFORM1 ==> InputFormFunctions1(%)
+
+ convert(s: %): InputForm ==
+
+ seg := packageCall("SEGMENT"::Symbol,
+ [convert(low s)@InputForm,
+ convert(hi s)@InputForm])$INFORM1
+ if one?(incr s)
+ then seg
+ else packageCall("BY"::Symbol,
+ [seg, convert(incr s)@InputForm])$INFORM1
+
if S has OrderedRing then
expand(ls: List %):List S ==
lr := nil()$List(S)
@@ -246,6 +261,7 @@
++ \spad{v=a..b}, then \spad{segment(segb)} returns \spad{a..b}.
if S has SetCategory then SetCategory
+ if S has ConvertibleTo InputForm then ConvertibleTo InputForm
== add
Rep := Record(var:Symbol, seg:Segment S)
equation(x,s) == [x, s]
@@ -259,6 +275,13 @@
coerce(b:%):OutputForm ==
variable(b)::OutputForm = segment(b)::OutputForm
+ if S has ConvertibleTo InputForm then
+ INFORM1 ==> InputFormFunctions1(%)
+ convert b ==
+ packageCall("equation"::Symbol,
+ [convert(variable(b))@InputForm,
+ convert(segment(b))@InputForm])$INFORM1
+
@
\section{package SEGBIND2 SegmentBindingFunctions2}
<<package SEGBIND2 SegmentBindingFunctions2>>=
@@ -387,6 +410,23 @@
inc = 1 => seg
infix(" by "::OutputForm, seg, inc::OutputForm)
+ if S has ConvertibleTo InputForm then
+ INFORM1 ==> InputFormFunctions1(%)
+
+ convert(s: %): InputForm ==
+ if hasHi s then
+ seg := packageCall("SEGMENT"::Symbol,
+ [convert(low s)@InputForm,
+ convert(hi s)@InputForm])$INFORM1
+ else
+ seg := packageCall("SEGMENT"::Symbol,
+ [convert(low s)@InputForm])$INFORM1
+ if one?(incr s)
+ then seg
+ else packageCall("BY"::Symbol,
+ [seg, convert(incr s)@InputForm])$INFORM1
+
+
if S has OrderedRing then
expand(s:%) == expand([s])
map(f:S->S, s:%) == map(f, expand s)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---