axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] Questions


From: David MENTRE
Subject: Re: [Axiom-developer] Questions
Date: Wed, 07 Jan 2004 23:34:59 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

Hello Dylan,

address@hidden (Dylan Thurston) writes:

> A better name for this function might be 'constant'.  'c +-> x +-> c'
> should be a function that takes an argument, 'c', and returns a function
> that takes an argument 'x', ignores x, and returns c.  That is, (cons 3)
> is a constant function that always returns 3.

Ok, that's what I guessed but I wasn't sure.

You can try:
(1) -> cons c == x +-> c
                                                                   Type: Void
(2) -> a := cons 3
   Compiling function cons with type PositiveInteger -> 
      AnonymousFunction 

   (2)  x +-> #1
                                                      Type: AnonymousFunction
(3) -> a 2

   (3)  #1
                                                            Type: Variable #1


> I'm quite worried by this bug, since it shows some really elementary
> failure of lexical scoping, which I understood Axiom to have.  I'll
> investigate as soon as I have a chance.

However, I'm not sure if it is really a bug or a bad bahavior of Axiom
type inference system. For example, is 'c' or 'x' interpreted as a
function variable or as a polynomial variable?

You might want to try first to precise the type of arguments and
returned type when defining cons function.

If you have access to Axiom book, chapter 6 would be a must read. 

Yours,
d.
-- 
David MENTRE <address@hidden> -- http://www.nongnu.org/axiom/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]