Hi Waldek,

On 05/13/2008 11:01 PM, Waldek Hebisch wrote:
> Ralf Hemmecke 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? 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.)
>> Where can I find the specification on which you base your comment?
>>
>> The above code does indeed not compile (at least not in fricas). Why?
>>
> 
> See subsection 6.16 in Axion book.

Thanks for that reference. I've downloaded from
http://axiom-wiki.newsynthesis.org/Mirrors?go=/public/book2.pdf&it=Axiom+Book

> This describes interpretar
> language, but large part is valid for Spad.  In particular:
> 
>  Spad compiler scans your function line-by-line, from top-to-bottom.

So in SPAD, one has to declare the signature of a function before it can 
be used in mutual recursion.

>  The right-hand side of an assignment is looked at before the left-hand
>  side.
>  If variable x is referenced before it is assigned a value, it is a
>  free (global) variable.
>  If x is assigned a value before it is referenced, it is a
>  local variable.

Oh! I was looking for something like the last 2 sentences in the AUG.
So it is already in the SPAD specification.

And "free" and "local" are part of SPAD. Interesting.

But should I consider the following a bug?

http://axiom-wiki.newsynthesis.org/SandboxFreeAndLocal

> I am not sure if I want to make Spad compiler smarter in such
> cases: the snippet above is likely to be an error.  Also, as
> a reader I depend strongly on order: if want to know what z
> means I need to find where it is defined.  "Define before use"
> means that to find definition I need to look only _before_
> point of use.

What about mutual recursion with two functions of a domain that you 
don't want to export? Similar to Section
"Recursion within a Single Domain"
http://axiom-wiki.newsynthesis.org/MutualRecursion
but without export of "Odd" and "Even". The domain should rather export 
some function foo instead, which calls "Even" or "Odd".

Ralf

-------------------------------------------------------------------------
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