On 05/13/2008 05:26 PM, Bill Page wrote:
> On Tue, May 13, 2008 at 11:04 AM, Ralf Hemmecke <[EMAIL PROTECTED]> wrote:
>> ...
>> Ooops, what in
>>
>> )abbrev domain AAA Aaa
>> Aaa: with
>>     bar: Integer -> Integer
>>   == add
>>     (x: Integer := 4; y: Integer := 3)
>>     bar(a: Integer): Integer == x + a + z
>>     z: Integer := 3 + y
>>
>> would be illegal?
> 
> As I understand it under Gaby's change to OpenAxiom this would be (and
> is) illegal.
> 
>> I just had to replace (as I said) the braces by parentheses,
>> since parens are used to group sequences of commands.
>> (Same as braces in Aldor.)
> 
> Do you think grouping sequences of commands by parens is entirely
> equivalent to code indentation?

No, I don't think so. But the code from the AUG is exactly like the 
above. In Aldor braces are used for grouping a sequence of commands. (In 
fact, Aldor allows to use parenthesis as in Axiom, but I did not really 
have the need to use parens instead of braces.)

So, I think the proper translation of the AUG Aldor code chunk into 
Axiom is just replacing braces by parentheses.

That I could not write

   z: Integer == 3 + y

("==" instead of ":=") was somehow a surprise to me, but I don't know 
SPAD so well. So my question would be, how to use a delayed assignment 
so that whenever I later call "bar(100)", z would be properly defined?

>> The above code does indeed not compile (at least not in fricas).
>> Why?

> Obviously because z is not "known" to the compiler when compiling
> 'bar'. It is nowhere is scope and has not been given any declaration
> locally. Right? What else would you expect?

> http://axiom-wiki.newsynthesis.org/SandBoxLexicalScope#bottom

Good question. Let's ask the compiler experts what the value of x should 
be in the following piece of code.

z: Integer := 0
foo(n: Integer): Integer == n + z
z := 1
x := foo(0)

Ralf

-----------------------------------------------------------------------
For your convinience...

)abbrev domain AAA Aaa
Aaa: with
   foo: Integer -> Integer
  == add
   z: Integer := 0
   foo(n: Integer): Integer == n + z
   z := 1

So why would I need "z: Integer := 0"?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to