[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] RE: Cast = pretend in Spad/Aldor?
From: |
root |
Subject: |
Re: [Axiom-developer] RE: Cast = pretend in Spad/Aldor? |
Date: |
Tue, 22 Nov 2005 03:59:30 -0500 |
The example
> (1) -> I:Integer
> Type: Void
> (2) -> F:Float:=1.0
>
> (2) 1.0
> Type: Float
> (3) -> I := F pretend Integer
>
> (3) 1()
'pretend' is only for system-internal use. it basically says: i KNOW
the exact internal representation of this thing so trust me. But here
is the exact internal rep of 1.0 (at some level)
(1) -> )lisp trace |pf2Sex|
(2) -> 1.0
1> (|pf2Sex| ((|float| (|posn| (0 "1.0" 1 1 "strings") . 0)) . "1.0e0"))
<1 (|pf2Sex| ((|$elt| (|Float|) |float|) 1 0 10))
(2) 1.0
Type: Float
(3) -> 1
1
1> (|pf2Sex| ((|integer| (|posn| (0 "1" 1 1 "strings") . 0)) . "1"))
<1 (|pf2Sex| 1)
(3) 1
Type: PositiveInteger
so you're lying to Axiom and it shows.
pretend is used in algebra code when you've created a primitive domain
representation that has an exact representation of another domain as
a lisp object. So you can do things like (from outform.spad)
sex := interpret(packageTran(ncParseFromString(s)$Lisp)$Lisp)$Lisp
sCheck := car(car(sex))
if (sCheck=sexfloat) = true then
f := (cdr cdr sex) pretend Float
else
if integer?(cdr sex) = true then
f := (cdr sex) pretend Integer
f::F
else
error "Non-numeric value"
notice that you've actually grabbed the output of a lisp function
(thus the calls to $Lisp) and are manipulating it to find the
exact representation of the algebra object. if you use pretend
you MUST understand the underlying lisp representations.
you'll also note that this makes it hard to move the axiom algebra
off of lisp and onto aldor. aldor needs to have the exact representation
that axiom uses which implies that aldor would have to have a lisp-like
internal data representation. so first you have to create a common lisp
in aldor then ....
this was the design issue with an aldor C implementation that i most
strongly disagreed with. as long as you don't try to cross the
aldor-axiom internal representations nothing will break. an aldor
rewrite of the spad compiler in common lisp would not have this issue.
in theory you COULD rewrite this into aldor if you moved the whole
system but you'd have to have primitives like CAR which understood
and could manipulate the underlying code for the domain as data.
this is why lisp wins as an implementation language because the
program==data duality allows this. i don't know how to rip and
tear a C program as data. how do you get the "first statement"
out of a C function, replace it with a different statement and
then execute it? the parenthesis syntax matters.
t
- Re: [Axiom-developer] B#, (continued)
- Re: [Axiom-developer] B#, Gabriel Dos Reis, 2005/11/21
- RE: [Axiom-developer] B#, Bill Page, 2005/11/21
- Re: [Axiom-developer] B#, Gabriel Dos Reis, 2005/11/21
- RE: [Axiom-developer] B#, Bill Page, 2005/11/21
- Re: [Axiom-developer] B#, Gabriel Dos Reis, 2005/11/21
- RE: [Axiom-developer] B#, C Y, 2005/11/21
- [Axiom-developer] Cast = pretend in Spad/Aldor? (was: B#), Bill Page, 2005/11/21
- [Axiom-developer] Re: Cast = pretend in Spad/Aldor? (was: B#), Gabriel Dos Reis, 2005/11/21
- [Axiom-developer] RE: Cast = pretend in Spad/Aldor?, Bill Page, 2005/11/21
- RE: [Axiom-developer] RE: Cast = pretend in Spad/Aldor?, Bill Page, 2005/11/21
- Re: [Axiom-developer] RE: Cast = pretend in Spad/Aldor?,
root <=
- RE: [Axiom-developer] RE: Cast = pretend in Spad/Aldor?, Bill Page, 2005/11/22
- Re: [Axiom-developer] RE: Cast = pretend in Spad/Aldor?, root, 2005/11/22
- Re: [Axiom-developer] RE: Cast = pretend in Spad/Aldor?, C Y, 2005/11/22
- RE: [Axiom-developer] RE: Cast = pretend in Spad/Aldor?, Bill Page, 2005/11/22
- Re: [Axiom-developer] Cast = pretend in Spad/Aldor? (was: B#), Peter Broadbery, 2005/11/22
- RE: [Axiom-developer] Cast = pretend in Spad/Aldor? (was: B#), Bill Page, 2005/11/22
- Re: [Axiom-developer] Cast = pretend in Spad/Aldor? (was: B#), Ralf Hemmecke, 2005/11/23
- RE: [Axiom-developer] Cast = pretend in Spad/Aldor?, Bill Page, 2005/11/23
- Re: [Axiom-developer] B#, Hans Peter Würmli, 2005/11/21
RE: [Axiom-developer] B#, Bill Page, 2005/11/21