> Does SPAD support optional arguments to functions?

Aldor does, but to my knowledge SPAD does not. But you can overload
function names, see below.

Does that help?

Ralf

-- foo.spad
)abbrev package FOO Foo
Foo(T: Ring): with
    foo: T -> T
    foo: (T, T) -> T
  == add
    foo(x: T, y: T): T == 10*x+y
    foo(x: T): T == foo(x, 1)
------------------------

(1) -> )co foo.spad

(1) -> foo(3)$Foo(Integer)

   (1)  31
                                    Type: Integer
(2) -> foo(1,7)$Foo(Integer)

   (2)  17
                                    Type: Integer
(3) -> foo(4.0)$Foo(Float)

   (3)  41.0
                                    Type: Float
(4) -> foo(1.0, 1.9)$Foo(Float)

   (4)  11.9
                                    Type: Float

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to