Google Groups Home
Help | Sign in
PrintLn and long numbers
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Akshaal  
View profile
 More options Jul 20, 12:38 pm
From: Akshaal <l...@toril.ru>
Date: Sun, 20 Jul 2008 09:38:45 -0700 (PDT)
Local: Sun, Jul 20 2008 12:38 pm
Subject: PrintLn and long numbers
Termware is a very good framework for high level computations. But
there is a room to grow. Is there ongoing work to remove
System.out.println from the sources and add a support for long number
values?

For example,

TermSystem termSystem =
            new TermSystem (new FirstTopStrategy (),
                            new DefaultFacts (),
                            TermWare.createNewInstance ());

termSystem.addRule ("A -> B [test(1216568340864)]");

will get you exception (see below) on the screen only and behavior as
if you have given it ""A -> B [test(0)]"".

Number format exception:java.lang.NumberFormatException: For input
string: "1216568340864"


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ruslan.s.shevche...@gmail.com  
View profile
 More options Jul 21, 1:54 pm
From: ruslan.s.shevche...@gmail.com
Date: Mon, 21 Jul 2008 10:54:24 -0700 (PDT)
Local: Mon, Jul 21 2008 1:54 pm
Subject: Re: PrintLn and long numbers

On Jul 20, 7:38 pm, Akshaal <l...@toril.ru> wrote:

> Termware is a very good framework for high level computations. But
> there is a room to grow. Is there ongoing work to remove
> System.out.println from the sources and add a support for long number
> values?

1.  We have no System.out.println in sources
  //instead we passing env object, which user can substitute to own.

So, to redirect outpot to own  logger, write class which implements
IEnv (http://www.gradsoft.ua/rus/Products/termware/jdocs/ua/gradsoft/
termware/IEnv.html)
and set one as output to system, like

IEnv emyEnv = new MyEnv();
termSyste.setEmv(myEnv);

// If somewhere exists System.out() - than this is packaging error.
Tell me and I will repackage next minor release immediatly

> For example,

> TermSystem termSystem =
>             new TermSystem (new FirstTopStrategy (),
>                             new DefaultFacts (),
>                             TermWare.createNewInstance ());

> termSystem.addRule ("A -> B [test(1216568340864)]");

> will get you exception (see below) on the screen only and behavior as
> if you have given it ""A -> B [test(0)]"".

> Number format exception:java.lang.NumberFormatException: For input
> string: "1216568340864"

Hmm -- good idea ;)

 I think we will include some syntax for inline big numbers in next
release
(now we support ones internally)

Note, that now you can pass big numbers to terms from java .


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ruslan.s.shevche...@gmail.com  
View profile
 More options Jul 21, 2:02 pm
From: ruslan.s.shevche...@gmail.com
Date: Mon, 21 Jul 2008 11:02:58 -0700 (PDT)
Local: Mon, Jul 21 2008 2:02 pm
Subject: Re: PrintLn and long numbers

On Jul 20, 7:38 pm, Akshaal <l...@toril.ru> wrote:

> Termware is a very good framework for high level computations. But
> there is a room to grow. Is there ongoing work to remove
> System.out.println from the sources and add a support for long number
> values?

1.  We have no System.out.println in sources, instead we pass to
system callback interface IEnv,
which incapsulate all output.
I.e. to handle output by own methods, you must
a)  create class IEnv whith own implementation of getOutput(),
getLog() and show()
b)  pass own env to system with help of TermSystem.setEnv method

i.e. code will look like
IEnv myEnv = new MyEnv();
termSystem.setEnv(myEnv);

> For example,

> TermSystem termSystem =
>             new TermSystem (new FirstTopStrategy (),
>                             new DefaultFacts (),
>                             TermWare.createNewInstance ());

> termSystem.addRule ("A -> B [test(1216568340864)]");

> will get you exception (see below) on the screen only and behavior as
> if you have given it ""A -> B [test(0)]"".

> Number format exception:java.lang.NumberFormatException: For input
> string: "1216568340864"

About handling big numbers in text -- goog idea.

for now we support big integers internally, i.e.
Term term = termFactory.createBigInteger(bi);
will work.

I think in shortcoming release we will propose some syntax for
handling big integers in strings.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Evgeny Chukreev  
View profile
 More options Jul 21, 2:20 pm
From: Evgeny Chukreev <l...@toril.ru>
Date: Mon, 21 Jul 2008 21:20:47 +0300
Local: Mon, Jul 21 2008 2:20 pm
Subject: Re: PrintLn and long numbers
On Mon, 21 Jul 2008 11:02:58 -0700 (PDT)
     <ruslan.s.shevche...@gmail.com> wrote me:

Sorry, it were not System.out.println, but System.err.println, like
System.err.println("Number format exception:"+ex.toString());
in TermWare1.jj

It would be nice to have such lines migrated to use IEnv for exception
handling (not just printing of error message, but handling as well, so one
could stop parsing).

I suppose 1216568340864L (pay attention to L suffix) is natural enough for
Long value.

--
... WBR, Evgeny Chukreev ...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ruslan.s.shevche...@gmail.com  
View profile
 More options Jul 22, 10:41 am
From: ruslan.s.shevche...@gmail.com
Date: Tue, 22 Jul 2008 07:41:31 -0700 (PDT)
Local: Tues, Jul 22 2008 10:41 am
Subject: Re: PrintLn and long numbers

 Thanks - will be fionxed in 2.3.1

 Yes. Will be implemented in next release.
  (Note, that if you don't want to wait, than changes  to TermWare1.jj
for this will be near trivial and we accept patches ;) )


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google