On 11/13/2008 06:45 PM, Bill Page wrote:
> Martin,
>
> On Wed, Nov 12, 2008 at 4:33 AM, you wrote:
>> ...
>> I noticed that my spad file was flawed, it seems that I can't get Rep and
>> % right in Spad. In aldor it's so easy... At least, now FriCAS doesn't
>> complain anymore about the Rep.
>>
>> Could we add these two macro definitions to FriCAS? (I'd rather have
>> them as macros, not builtin as in Open-Axiom, I must admit)
>>
>> macro {
>> rep x == ((x)@%) pretend Rep;
>> per r == ((r)@Rep) pretend %;
>> }
>>
>
>>From my point of view these operations are an essential part of the
> SPAD language even though most of the legacy code in the Axiom library
> does not use them in a type-sage manner.
>
> Could you explain why you prefer these to be pre-defined macros rather
> than being builtin as Gaby has done in OpenAxiom and Aldor?
You should (currently) delete "and Aldor" from the last sentence.
https://svn.origo.ethz.ch/algebraist/trunk/aldor/lib/aldor/include/aldor.as
Of course, one can make these things into a language defined concept.
However, one can also consider them to be just a convention.
This % thing is rather driven by the concept of universal algebra where
Rep refers to the carrier set. It's in some sense nice, since universal
algebra comprises a lot of cases, but take, for example, zero?: % ->
Boolean. Strictly speaking, this function cannot live in a universal
algebra, since Boolean is not the carrier set.
Let's look at this
Dom: with {
+: (%, %) -> %
zero?: % -> Boolean
} == add { ... }
Here % refers to Dom and Boolean refers to the globally defined domain
Boolean. So why not writing
Dom2(C: T1, Boolean: T2): with {
+: (C, C) -> C
zero?: C -> Boolean
} == add { ... }
where for T2 one has to specify the type that Boolean must fulfil inside
Dom2 and T1 is ??? Well, T1 is a problem. But not really.
((NB. Don't be confused that in Dom2 "Boolean" is the name of a
parameter and has nothing to do with a globally defined domain of the
same name.))
I guess, one can program in Aldor without ever using %. But then Aldor
will look much more object oriented (... don't take this too serious).
In fact Dom2 looks more like a multi-sorted algebra.
Dom2 = ((C, Boolean), (+, zero?))
Speaking in Aldor-terminology, Dom2 is, however, just a package (i.e. a
domain in whose definition no % appears).
Maybe it could be fun to think a bit along these lines...
Ralf
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
open-axiom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel