People,
I have the following notes and questions on Axiom and on the book
"Axiom. The 30 year Horizon",
which I have downloaded together with the FriCAS-1.1.4 source.
Margines On the pages No 105, 144, 1006 there are several lines
-------- that exheed the right margine.
The three languages
-------------------
The book mentiones the languages Spad (=?= Scratchpad ), Axiom, Aldor.
What is the difference? Which one in described in the book?
Which one is implemented in FriCAS-1.1.4 ?
Spad \ ML = ? Spad \ Haskell = ?
---------------------------------
What principal language constructs Spad (Axiom, Aldor) has that cannot
be replaced with the ML language constructs
(classes, structures, functors ...).
I am experienced in Haskell and know very few of ML, so the question is
mainly on Spad vs Haskell
(and apart from Haskell's "laziness" and functionality).
Language or Library?
--------------------
In about 1992, I looked into the book on Axiom, spent a couple of days
and was puzzled, could not understand what is the very programming
language. I thought
"Is this a domain-specific language for mathematics?
Do they think that to program trains one needs a language with the
constructs of Train, Rails and Station, and to program mathematics the
language needs the constructs of Matrix and PolynomialDomain and such?
"
Then I looked into ML and Haskell: classes, instances, etc.
Then, I wrote a certain small algebraic library (a prototype of DoCon)
in Haskell.
Another reasons for doing this was that
1) Axiom was commercial and not open-source,
2) Haskell is functional, "lazy", elegant, popular, open source,
and reliably implemented and supported.
I think that generally, a set of the language constructs must be possibly
small and universal (not specialized to mathematics), and all the rest
must be of the Library and be written in this very language.
For example, take a small universal language, say, ML or Haskell, --
popular and reliably implemented and supported --
and write in it a library for mathematics.
Why does one need to introduce for this a new language (known to almost
nobody), does not this lead to a concept confusion, to an user confusion?
And in DoCon, it was (is) clear where is the language (Haskell) and
where is the library (DoCon itself).
Then, in about 1996, I again looked into the Axiom book. And suspected
that many items in it, which I thought as of the language, are, probably,
of the Library (hopefully written in Axiom).
In the book, the language features are mixed with the library features,
so that it is difficult to understand what construct is of the library
and what is of the Spad (Axiom) language.
In many places it is written in this book "Axiom",
"Axiom has this and this" -- without making it clear:
the Axiom language or the Axiom library?
Really, this ambiguity is great.
The chapter
1. An Overwiew of Axiom
has the subsection 1.3. The Axiom language.
Then, there follows
1.4 Numbers,
and there are given the examples of the number expressions, as
x : IntegerMod 6 := 5 and rootOf(...).
I guess now that IntegerMod is a domain constructor of the Library,
it is not a language construct for forming a number expression (is it?).
Similarly, I guess that rootOf is a library function (implemented in
Spad), and is not a language operation (like +, * ...) for forming an
arithmetical expression (is it?).
Further:
1.8 Polynomials
A naive reader sees here "Polynomial ... UP(x, INT) ..."
and thinks "Oh, this is a special mathematical language to express
polynomials and their domains, and such objects".
I suggest to insert in many appropriate places in this books the phrases
like
"the Axiom library has the domain constructor Polynomial, which ...",
"the Axiom language has the constructs of Category, Domain,
type declaration ...".
And to put this explicit in each place where there might be such and
ambiguity. In this case the book would be much easier to understand.
Page 105. `Table' (and its related operations) is, probably, not of the
Language but a constructor from the Library.
For example, the Glasgow Haskell system has the corresponding constructor
Map in the Library.
Then, it follows `Record' in the book. And it is, probably, a construct of
the Language (in Haskelll records are in the language).
But Record is explained near Table, so a language feature is mixed with
library features (?)
Then, after this "Overview of Axiom", it follows
2. Using Types and Modes
And I guess that the subject has again, changed: this chapter is not on
the library, but on the programming language (Spad?, Axiom? Aldor?).
Is this so?
And so on.
Then, there goes "Advanced Problem Solving", like Groebner basis,
polynomial factorization, and such.
Yes! this time I know that this is not of the language.
Then: Chapter 12. Categories.
Probably, this is of the language!
Comparison to some Haskell features
-----------------------------------
a) Union of types is good.
b) `case x <type>' is good.
c) Using Subdomain, `pretend' looks good.
d) Rules are good,
because rule sin(2*x) == 2*sin(x)*cos(x)
cannot be written as sin(2*x) = 2*sin(x)*cos(x) in Haskell.
The Haskell programs often compute by pattern matching, but not of
the LHS part of such kind.
e) Clarity of the code.
For example, consider the lexicographic list comparison:
lexListComp :: Ord a => [a] -> [a] -> ComparisonValue
lexListComp xs ys = case (xs, ys)
of
([], [] ) -> EQ
([], _ ) -> LT
(_, [] ) -> GT
(x: xs', y: ys') -> case compare x y
of
EQ -> lexListComp xs' ys'
v -> v
(no `val', no `defun', few parentheses,
the long word `lexListComp' is not repeated).
What is the nicest code for this in Spad ?
Another question is about nested local values introduced by let-in and
"where". For example,
f x = let (p: (y, z): _) = g x x
h ys = let h' = (\ x -> [x]) in ...
in
h [p, y, z]
Dependent types
---------------
Also there exists a particular question of dependent types and
dependent instances (domains). In Haskell they are not possible.
Due to this, DoCon has a more complicated architecture than it might have.
And I do not know whether they really work in Aldor or in the current Spad.
History
-------
The DoCon library started in about 1995. In 2000 I got tired and stopped it.
Very few items were improved since 2000.
Noone uses it except myself (about 2 weeks in an year).
I think, the main reason for this is that the set of the implemented
methods is 50-100 times smaller that in Axiom of 2000.
In about 2003 I read about that Axiom has become open source, also read
about Aldor, which was not open source. And I had an impression that the
Aldor implementation was not workable in 2003.
Now, someone wrote to me unexpectedly about DoCon and Axiom.
So, I have now installed FriCAS and looked in the book once more, and
decided to write these questions and notes.
Thank you in advance for explanation.
Regards,
------
Sergei
--
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.