Hello,
it looks like SPAD is quite picky when it comes to identifiers like /\.
This works with the attached program.
(3) -> foo("a","b")
(3) "a"
Type:
String
(4) -> "a" /\ "b"
(4) "a"
Type:
String
But unfortunately in SPAD, I always have to escape /\. That's very
uncomfortable and looks ugly in the code.
It's also not clear to me why I am unable to compile
((x: String) _/_\ (y: String)): String == x
it gives
initializing NRLIB FOO for Foo
compiling into NRLIB FOO
processing macro definition Rep ==> String
compiling exported x : -> String
Semantic Errors:
[1] x: argument (/\ (: y (String))) of (x (/\ (: y (String)))) is
not declared
Warnings:
[1] x: x has no value
****** comp fails at level 1 with expression: ******
error in function x
(|x|)
****** level 1 ******
$x:= x
$m:= (String)
$f:=
((((|/\\| # . #1=#) (|Rep| #) (|$Information| #) (|/\\| . #1#) ...)))
>> Apparent user error:
unspecified error
Would it be hard to recognize +, -, *, \/, /\, etc. in places like
/\: (A, B) -> C
and
a /\ b
without the need to escape them?
Why do I get
compiling exported foo : (String,String) -> String
****** comp fails at level 2 with expression: ******
error in function foo
(|x| | << | (|/\\| |y|) | >> |)
****** level 2 ******
$x:= (/\ y)
$m:= $EmptyMode
$f:=
((((|y| # . #1=#) (|x| # #) (|y| . #1#) (|#| #) ...)))
>> Apparent user error:
no modemap for /\ with 1 arguments
if I have chosen to compile the line
foo(x: String, y: String): String == x _/_\ y
Of course the unescaped line also doesn't compile
******** Spad syntax error detected ********
Expected: BACKTAB
The prior line was:
9> _/_\(x: String, y: String): String == x
The current line is:
12> foo(x: String, y: String): String == x /\ y
The number of valid tokens is 1.
The prior token was #S(TOKEN
:SYMBOL |x|
:TYPE IDENTIFIER
:NONBLANK NIL
:LINE_NUM 12
:CHAR_NUM 41)
The current token is #S(TOKEN
:SYMBOL SLASHBACKSLASH
:TYPE KEYWORD
:NONBLANK NIL
:LINE_NUM 12
:CHAR_NUM 43)
Ralf
---------------------------------------------------------
per x ==> (x@Rep) pretend %
)abbrev package FOO Foo
Foo: with
foo: (String, String) -> String
_/_\: (String, String) -> String
== add
Rep ==> String
_/_\(x: String, y: String): String == x
-- ((x: String) _/_\ (y: String)): String == x
foo(x: String, y: String): String == _/_\(x, y)
-- foo(x: String, y: String): String == x /\ y
-- foo(x: String, y: String): String == x _/_\ y
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.