Re: [fricas-devel] output file type....

2021-11-28 Thread Sid Andal
Thanks! This is exactly that I was looking for.

On Thursday, November 25, 2021 at 12:03:01 PM UTC-6 Bill Page wrote:

>
> On Thu, Nov 25, 2021 at 12:14 PM Sid Andal  wrote:
>
>> The question was very clear and self explanatoryI asked how to output 
>> a string into a file without the leading "1." and without the double quotes.
>>
>
> (1) -> )sys cat test.input
> f : TextFile := open("test.out", "output")
> writeLine!(f, unparse([1,2,3,4,5,6,7,8]::InputForm))
> writeLine!(f, "0123456789")
> close!(f)
> (1) -> )r test
> f : TextFile := open("test.out", "output")
>  
>
>(1)  "test.out"
>Type: 
> TextFile
> writeLine!(f, unparse([1,2,3,4,5,6,7,8]::InputForm))
>  
>
>(2)  "[1,2,3,4,5,6,7,8]"
>  Type: 
> String
> writeLine!(f, "0123456789")
>  
>
>(3)  "0123456789"
>  Type: 
> String
> close!(f)
>  
>
>(4)  "test.out"
>Type: 
> TextFile
> (5) -> )sys cat test.out
> [1,2,3,4,5,6,7,8]
> 0123456789
> (5) -> 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/4521445e-a926-4e74-aa97-c15820888d1cn%40googlegroups.com.


Re: [fricas-devel] output file type....

2021-11-25 Thread Bill Page
On Thu, Nov 25, 2021 at 12:14 PM Sid Andal  wrote:

> The question was very clear and self explanatoryI asked how to output
> a string into a file without the leading "1." and without the double quotes.
>

(1) -> )sys cat test.input
f : TextFile := open("test.out", "output")
writeLine!(f, unparse([1,2,3,4,5,6,7,8]::InputForm))
writeLine!(f, "0123456789")
close!(f)
(1) -> )r test
f : TextFile := open("test.out", "output")


   (1)  "test.out"
   Type:
TextFile
writeLine!(f, unparse([1,2,3,4,5,6,7,8]::InputForm))


   (2)  "[1,2,3,4,5,6,7,8]"
 Type:
String
writeLine!(f, "0123456789")


   (3)  "0123456789"
 Type:
String
close!(f)


   (4)  "test.out"
   Type:
TextFile
(5) -> )sys cat test.out
[1,2,3,4,5,6,7,8]
0123456789
(5) ->

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/CAC6x94RVg9uAnQL5dGbrWZks%3Dgcuwa-dQHCjpH%2BatHdoEMhH8A%40mail.gmail.com.


Re: [fricas-devel] output file type....

2021-11-25 Thread Sid Andal
The question was very clear and self explanatoryI asked how to output a 
string into a file without the leading "1." and without the double quotes.

On Wednesday, November 24, 2021 at 5:12:22 PM UTC-6 ra...@hemmecke.org 
wrote:

> > I'm not aware if there are better ways to do file I/O in fricas.
>
> Maybe not better ways, but if you just complain and do not say what
> exactly you want, I do no longer waste my time in trying to help you.
>
> > I have a large script that does many algebraic calculations and then
> > outputs the result to a file.
>
> Sounds as everything is fine an there is no problem.
>
> > The output consists of algebraic types as well as strings of text and
> > I don't know how to output them all together nicely!
> ???
>
> Ralf
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/c862e137-2bc6-4795-bb33-7499c9531705n%40googlegroups.com.


Re: [fricas-devel] output file type....

2021-11-24 Thread Ralf Hemmecke
> I'm not aware if there are better ways to do file I/O in fricas.

Maybe not better ways, but if you just complain and do not say what
exactly you want, I do no longer waste my time in trying to help you.

> I have a large script that does many algebraic calculations and then
>  outputs the result to a file.

Sounds as everything is fine an there is no problem.

> The output consists of algebraic types as well as strings of text and
> I don't know how to output them all together nicely!
???

Ralf

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/6fa65573-270e-7ad4-f807-0080dc705639%40hemmecke.org.


Re: [fricas-devel] output file type....

2021-11-24 Thread Sid Andal
I was basically going according to book.pdf. I'm not aware if there are 
better ways to do file I/O in fricas. I have a large script that does many 
algebraic calculations and then outputs the result to a file. The output 
consists of algebraic types as well as strings of text and I don't know how 
to output them all together nicely! Also, I'm not familiar with SPAD.

On Wednesday, November 24, 2021 at 3:06:19 PM UTC-6 ra...@hemmecke.org 
wrote:

> Why do you think it is wrong?
>
> https://github.com/fricas/fricas/blob/master/src/algebra/files.spad#L132
>
> Honestly, I could not judge this. The docstring for write!
>
>
> http://fricas.github.io/api/FileCategory.html#l46696c6543617465676f7279-777269746521
>
> is not very precise.
>
> The only thing you can say is that it is not what you expected.
> Just to make things clear.
>
> OK, but that doesn't help you. I was anyway wondering why you would be
> satisfied with output that looks pretty LISP like. Is this really what
> you want?
>
> Don't just work on "somehow getting some output". Try to specify exactly
> what you want and how you want it. Maybe your input data comes in a
> certain format from somewhere and you want you output in a certain
> format for further use. So what is it?
>
> Maybe putting together a few lines of FriCAS code and a little shell
> script may better serve your purpose. However, to be able to help you,
> you must be much clearer.
>
> Ralf
>
> PS:
> I actually don't care about what write! outputs. I never had such a need
> to use it. As I said before, the fricas output of
> https://fricas.github.io/book.pdf was produced automatically. And since
> I programmed it I know that there is not write! command in the process.
>
>
>
> On 24.11.21 20:34, Sid Andal wrote:
> > 
> > I have an output file opened of type union (for mixed types):
> > 
> > f : File Union(List Integer, String) := open("test.out", "output")
> > write!(f, [1,2,3,4,5,6,7,8])
> > write!(f, "0123456789")
> > close!(f)
> > 
> > Here's the content of test.out:
> > 
> > (0 1 2 3 4 5 6 7 8) 
> > 
> > (1 . "0123456789")
> > 
> > The 2nd line containing the string doesn't look right. How do I print 
> the 
> > string itself (without the prefix 1.) and without the double-quotes?
> > 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/0a4e2904-603b-41be-a3cd-abef6fd48faan%40googlegroups.com.


Re: [fricas-devel] output file type....

2021-11-24 Thread Ralf Hemmecke
Why do you think it is wrong?

https://github.com/fricas/fricas/blob/master/src/algebra/files.spad#L132

Honestly, I could not judge this. The docstring for write!

http://fricas.github.io/api/FileCategory.html#l46696c6543617465676f7279-777269746521

is not very precise.

The only thing you can say is that it is not what you expected.
Just to make things clear.

OK, but that doesn't help you. I was anyway wondering why you would be
satisfied with output that looks pretty LISP like. Is this really what
you want?

Don't just work on "somehow getting some output". Try to specify exactly
what you want and how you want it. Maybe your input data comes in a
certain format from somewhere and you want you output in a certain
format for further use. So what is it?

Maybe putting together a few lines of FriCAS code and a little shell
script may better serve your purpose. However, to be able to help you,
you must be much clearer.

Ralf

PS:
I actually don't care about what write! outputs. I never had such a need
to use it. As I said before, the fricas output of
https://fricas.github.io/book.pdf was produced automatically. And since
I programmed it I know that there is not write! command in the process.



On 24.11.21 20:34, Sid Andal wrote:
> 
> I have an output file opened of type union (for mixed types):
> 
> f : File Union(List Integer, String) := open("test.out", "output")
> write!(f, [1,2,3,4,5,6,7,8])
> write!(f, "0123456789")
> close!(f)
> 
> Here's the content of test.out:
> 
> (0 1 2 3 4 5 6 7 8) 
> 
> (1 . "0123456789")
> 
> The 2nd line containing the string doesn't look right. How do I print the 
> string itself (without the prefix 1.) and without the double-quotes?
> 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/9e29da54-40fd-8a59-afce-0cac76d1353f%40hemmecke.org.


[fricas-devel] output file type....

2021-11-24 Thread Sid Andal

I have an output file opened of type union (for mixed types):

f : File Union(List Integer, String) := open("test.out", "output")
write!(f, [1,2,3,4,5,6,7,8])
write!(f, "0123456789")
close!(f)

Here's the content of test.out:

(0 1 2 3 4 5 6 7 8) 

(1 . "0123456789")

The 2nd line containing the string doesn't look right. How do I print the 
string itself (without the prefix 1.) and without the double-quotes?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/30614e1e-373e-4c50-b522-67a6e4642228n%40googlegroups.com.