"Bill Page" <[EMAIL PROTECTED]> writes:

| panAxiom developers,
| 
| I just wanted to mention something here that I just learned about how
| the Axiom interpreter handles option arguments. When discovering how
| the 'draw' operations in Axiom processes optional arguments, e.g.
| 
|   draw(sin(x), x=1..10, title=="sin function")

Hmm, I thought I already mentioned this in discussions with Ralf ;-/

| 
| I realized the interpreter does something rather clever but probably
| quite unexpected.

It is the post parser doing it.  And I don't like it -- the irony is
that I made Boot do the same. 

| The problem is that (unlike Aldor) SPAD does not
| provide built-in support for calling functions with optional
| arguments. Instead what it does is collect all the arguments
| containing == into a List *and* then it applies the name to the left
| of == as a function to the value on the right. So much to my surprize:

Quite disgusting, no?

| 
| (1) -> (x+->x)(sin==x,cos==y)
| 
|    (1)  [sin(x),cos(y)]
| 
|                                   Type: List Expression Integer
| 
| is equivalent to:
| 
| (2) -> (x+->x)([sin(x),cos(y)])
| 
|    (2)  [sin(x),cos(y)]
| 
|                                    Type: List Expression Integer
| 
| The list of optional arguments is always passed as the last argument
| to the function. This is completely general so one can write for
| example:
| 
| (3) -> ((x,y)+->[x,y])(sin==x,n,cos==y)
| 
|    (3)  [n,[sin(x),cos(y)]]
| 
|                                      Type: List Any
| 
| What do you think? Do you like that, or is this something that should
| be implemented in a deeper way?

I don't like it:  For example, I cannot '==' to mean `definition' in
expressions -- but I already had that debate with Ralf.

-- Gaby

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to