From: Gabriel Dos Reis <gdr@cs...> - 2012-02-02 17:42:36
"Serge D. Mechveliani" <mechvel@...> writes:
| can you, please, answer the following beginner questions about the Spad
| language and library?
| escape() Instead of '`' it shows the underscore: '_'
| -------- (in fricas-1.1.5).
| Is this all right?
espace designates the escape character in the Spad language.
| Defining a constant
| I define parentheses : () -> Set Character
| parentheses() == ...
| in a package.
| I need to apply it not as, for example, ps := f parentheses()
| but as ps := f parentheses,
| where parentheses : Set Caracter.
| But this latter does work. How to arrange this?
It works in OpenAxiom.
For other AXIOM flavours, you might want to use
parentheses: constant -> Set Character
But, I seem to remember that they are still lagging proper support for
constants whose types are not '%'.
| I tried parentheses : Set Character
| parentheses := ...
| ps := parentheses,
| but it does not work.
that would be the syntax for defining a variable. But there is no
support for exporting variables -- the best approximation is that you
use a unary function wrapper.
| Using type (domain) synomym
| I tried to declare in my package
| ... package ... with
| Lexeme : SetCategory
| spanStr : (Character -> Boolean, String) -> Product(Lexeme, String)
| Lexeme : SetCategory := String
| < a code using the Lexeme type as String >
| and had difficulties. Finally I replaced Lexeme with String.
| What is your advice on this?
Spad lacks good support for Sigma-types, so you need to define Lexeme as
a standalone functor in itself, outside the definition of your package.