concat string outputForm

0 views
Skip to first unread message

Serge D. Mechveliani

unread,
Feb 25, 2012, 11:21:52 AM2/25/12
to fricas...@googlegroups.com
Dear FriCAS developers,

The Spad of ... => error "Foo" (newline() :: OutputForm) " Foo"

is compiled by FriCAS-1.1.5, and at the run time, it reports

>> System error:
SYSTEM::%EXPAND-FORM: invalid form ("Foo"
((|::| (|newline|) (|OutputForm|)) " Foo")

I do not know whether this should pass the compiler,
I report this for any occasion.

Regards,

------
Sergei
mec...@botik.ru

Ralf Hemmecke

unread,
Feb 27, 2012, 2:07:15 AM2/27/12
to fricas...@googlegroups.com
On 02/25/2012 05:21 PM, Serge D. Mechveliani wrote:
> Dear FriCAS developers,
>
> The Spad of ... => error "Foo" (newline() :: OutputForm) " Foo"
>
> is compiled by FriCAS-1.1.5, and at the run time, it reports
>
> >> System error:
> SYSTEM::%EXPAND-FORM: invalid form ("Foo"
> ((|::| (|newline|) (|OutputForm|)) " Foo")

AFAIK, the function "error" expects a string as argument. What you have
given, isn't of type String. Maybe you should rather write

error concat ["foo",newline()::String,"bar"]

(I haven't actually tested it in SPAD, but it works on the command line.)

Ralf

Waldek Hebisch

unread,
Feb 27, 2012, 2:23:00 PM2/27/12
to fricas...@googlegroups.com
Serge D. Mechveliani wrote:
>
> Dear FriCAS developers,
>
> The Spad of ... => error "Foo" (newline() :: OutputForm) " Foo"
>
> is compiled by FriCAS-1.1.5, and at the run time, it reports
>
> >> System error:
> SYSTEM::%EXPAND-FORM: invalid form ("Foo"
> ((|::| (|newline|) (|OutputForm|)) " Foo")
>
> I do not know whether this should pass the compiler,
> I report this for any occasion.

Could you post complete example? When I tried to complete your
line I got error at compile time.

ATM I can not say if compiler should accept your line, but
if compiler accepts the line it should generate correct
code and the message suggests that this in not the case.

--
Waldek Hebisch
heb...@math.uni.wroc.pl

Waldek Hebisch

unread,
Feb 27, 2012, 2:31:39 PM2/27/12
to fricas...@googlegroups.com
Ralf Hemmecke wrote:
>
> On 02/25/2012 05:21 PM, Serge D. Mechveliani wrote:
> > Dear FriCAS developers,
> >
> > The Spad of ... => error "Foo" (newline() :: OutputForm) " Foo"
> >
> > is compiled by FriCAS-1.1.5, and at the run time, it reports
> >
> > >> System error:
> > SYSTEM::%EXPAND-FORM: invalid form ("Foo"
> > ((|::| (|newline|) (|OutputForm|)) " Foo")
>
> AFAIK, the function "error" expects a string as argument. What you have
> given, isn't of type String.

AFAICS Spad compiler converts application of a string to
another string into concatentation of strings. Assuming
this convertion the result is a string.

--
Waldek Hebisch
heb...@math.uni.wroc.pl

Ralf Hemmecke

unread,
Feb 27, 2012, 4:19:57 PM2/27/12
to fricas...@googlegroups.com
>>> The Spad of ... => error "Foo" (newline() :: OutputForm) " Foo"

>> AFAIK, the function "error" expects a string as argument. What you have


>> given, isn't of type String.

> AFAICS Spad compiler converts application of a string to
> another string into concatentation of strings. Assuming
> this convertion the result is a string.

1) The line above contains newline()::OutputForm. If it had been
::String, I wouldn't probably have had a big problem.

2) If the compiler implicitly treats

"a" "b"

as "ab" then that would mean either

a) the existence of a function
apply: (String, String) -> String
(or "elt" instead of "apply" since we are in SPAD instead of
Aldor), or

b) the SPAD compiler implements syntactic sugar to translate
s1 s2 ... sn into concat [s1,s2,...,sn] where the si are all of
type String, or

c) like b) except that all si must be String literals.

I don't know for sure, but I guess that c) holds.
Adding a function "elt"/"apply" could make that compiler feature irrelevant.

Waldek, don't you think that some day the domain Literal should be part
of SPAD?

Ralf

Serge D. Mechveliani

unread,
Feb 28, 2012, 10:51:21 AM2/28/12
to fricas...@googlegroups.com


Sorry, I have lost this state.
I thougth it is easy to reproduce, but it is not.
Also I have changed to FriCAS-1.1.6 built from source under SBCL 1.0.55
(it is about 3 times faster on my examples).

Regards,

------
Sergei
mec...@botik.ru


Reply all
Reply to author
Forward
0 new messages