rosettacode

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

rosettacode

rvjansen
Alan Sampson has contributed a number of NetRexx examples to http://rosettacode.org/wiki/Category:NetRexx

These will be added to the source code repository to serve both as examples and part of the regression test suite.
I see RossettaCode as an important site for NetRexx because it illustrates that our favourite languages can perform all these tasks with ease, in elegant and terse expression, and in most cases with great performance. More examples here will mean that the language has to be taken seriously, and receives exposure for its strong points. I want to applaud Alan, who decided to spend a part of the US holidays last week to put this together, and I would like to invite you all to have a look, and possibly contribute. Please send in the names of your additions to this list, so I can paste them into the set of examples.

best regards,

René Jansen


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: rosettacode

George Hovey-2
Rene,
I took a look at Alan's work and it is very nicely turned out.  However, I question the premise that NetRexx "can perform all these tasks with ease, in elegant and terse expression."  As a counter example, look at the coding of "Jensen's Device."

This looks like it was a brain teaser to get working (I doubt that it was developed with "ease"), and my hat's off to Alan.  However, as an advertisement for NetRexx it strikes me as atrocious.  There isn't a clue given as to what it is doing.  I suspect that people coming across this example would conclude that NetRexx is an impenetrable language.

On the other hand, the Arbitrary-precision integers example has all the claimed qualities, and nicely contrasts solutions involving Java classes with NetRexx's built-in math; NetRexx is plainly the winner on clarity, though not in speed.

This suggests to me that we should program only problems that do satisfy your premise, and leave the rest alone.
George
On Wed, Jul 6, 2011 at 11:14 AM, René Jansen <[hidden email]> wrote:
Alan Sampson has contributed a number of NetRexx examples to http://rosettacode.org/wiki/Category:NetRexx

These will be added to the source code repository to serve both as examples and part of the regression test suite.
I see RossettaCode as an important site for NetRexx because it illustrates that our favourite languages can perform all these tasks with ease, in elegant and terse expression, and in most cases with great performance. More examples here will mean that the language has to be taken seriously, and receives exposure for its strong points. I want to applaud Alan, who decided to spend a part of the US holidays last week to put this together, and I would like to invite you all to have a look, and possibly contribute. Please send in the names of your additions to this list, so I can paste them into the set of examples.

best regards,

René Jansen


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: rosettacode

rvjansen
Hi George,

well, Alan is not to blame for this, because I picked the sample and Kermit provided the termeval method - it *is* a proper Jensen's device that way; I also would like to see that replaced by a clean 'interpret' like the Rexx sample has. As this sample probably only matters to propellorheads/compiler geeks to whom the term 'call-by-name' has meaning, it is probably ok because it does show that NetRexx can do a proper 'Jensen'.

The arbitrary precision example also has some drawbacks - in the NetRexx idiomatic version its performance is indeed atrocious. By giving it two Gigs and running in 64 bit mode I could get it under ten minutes, but I am going to trace around sometime soon, because this is not exactly propaganda either.

The question here is if we leave those in, or wait until improved versions are available. For the moment, I would like to leave them as they are, but there is always (and literally everyone can edit Rosettaode) room for added/improved versions.

So let the competition start ...

best regards,

René.

On 6 jul 2011, at 19:26, George Hovey wrote:

Rene,
I took a look at Alan's work and it is very nicely turned out.  However, I question the premise that NetRexx "can perform all these tasks with ease, in elegant and terse expression."  As a counter example, look at the coding of "Jensen's Device."

This looks like it was a brain teaser to get working (I doubt that it was developed with "ease"), and my hat's off to Alan.  However, as an advertisement for NetRexx it strikes me as atrocious.  There isn't a clue given as to what it is doing.  I suspect that people coming across this example would conclude that NetRexx is an impenetrable language.

On the other hand, the Arbitrary-precision integers example has all the claimed qualities, and nicely contrasts solutions involving Java classes with NetRexx's built-in math; NetRexx is plainly the winner on clarity, though not in speed.

This suggests to me that we should program only problems that do satisfy your premise, and leave the rest alone.
George
On Wed, Jul 6, 2011 at 11:14 AM, René Jansen <[hidden email]> wrote:
Alan Sampson has contributed a number of NetRexx examples to http://rosettacode.org/wiki/Category:NetRexx

These will be added to the source code repository to serve both as examples and part of the regression test suite.
I see RossettaCode as an important site for NetRexx because it illustrates that our favourite languages can perform all these tasks with ease, in elegant and terse expression, and in most cases with great performance. More examples here will mean that the language has to be taken seriously, and receives exposure for its strong points. I want to applaud Alan, who decided to spend a part of the US holidays last week to put this together, and I would like to invite you all to have a look, and possibly contribute. Please send in the names of your additions to this list, so I can paste them into the set of examples.

best regards,

René Jansen


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: rosettacode

Kermit Kiser
We could probably document better what the Jensen's example is doing but I agree with René that it is a "propellorhead" sample and those folks can probably figure it out if they are really interested. I am not sure how we could add "interpret" to NetRexx for the general case though, since the interpreted instruction needs access to the caller's context to access the variable values. (Perhaps limit the expression to static variables and pass the calling class. Perhaps a separate interpret that passes the instance for access to instance variables?)

The arbitrary precision example on RosettaCode needs some work. The first two versions accidentally got the same code posted. And displaying the elapsed time for the calculation does not seem to be part of the other language versions. I would remove that to avoid scaring people! I doubt that many other languages are any better anyway.

- Kermit

On 7/6/2011 11:10 AM, René Jansen wrote:
Hi George,

well, Alan is not to blame for this, because I picked the sample and Kermit provided the termeval method - it *is* a proper Jensen's device that way; I also would like to see that replaced by a clean 'interpret' like the Rexx sample has. As this sample probably only matters to propellorheads/compiler geeks to whom the term 'call-by-name' has meaning, it is probably ok because it does show that NetRexx can do a proper 'Jensen'.

The arbitrary precision example also has some drawbacks - in the NetRexx idiomatic version its performance is indeed atrocious. By giving it two Gigs and running in 64 bit mode I could get it under ten minutes, but I am going to trace around sometime soon, because this is not exactly propaganda either.

The question here is if we leave those in, or wait until improved versions are available. For the moment, I would like to leave them as they are, but there is always (and literally everyone can edit Rosettaode) room for added/improved versions.

So let the competition start ...

best regards,

René.

On 6 jul 2011, at 19:26, George Hovey wrote:

Rene,
I took a look at Alan's work and it is very nicely turned out.  However, I question the premise that NetRexx "can perform all these tasks with ease, in elegant and terse expression."  As a counter example, look at the coding of "Jensen's Device."

This looks like it was a brain teaser to get working (I doubt that it was developed with "ease"), and my hat's off to Alan.  However, as an advertisement for NetRexx it strikes me as atrocious.  There isn't a clue given as to what it is doing.  I suspect that people coming across this example would conclude that NetRexx is an impenetrable language.

On the other hand, the Arbitrary-precision integers example has all the claimed qualities, and nicely contrasts solutions involving Java classes with NetRexx's built-in math; NetRexx is plainly the winner on clarity, though not in speed.

This suggests to me that we should program only problems that do satisfy your premise, and leave the rest alone.
George
On Wed, Jul 6, 2011 at 11:14 AM, René Jansen <[hidden email]> wrote:
Alan Sampson has contributed a number of NetRexx examples to http://rosettacode.org/wiki/Category:NetRexx

These will be added to the source code repository to serve both as examples and part of the regression test suite.
I see RossettaCode as an important site for NetRexx because it illustrates that our favourite languages can perform all these tasks with ease, in elegant and terse expression, and in most cases with great performance. More examples here will mean that the language has to be taken seriously, and receives exposure for its strong points. I want to applaud Alan, who decided to spend a part of the US holidays last week to put this together, and I would like to invite you all to have a look, and possibly contribute. Please send in the names of your additions to this list, so I can paste them into the set of examples.

best regards,

René Jansen


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: rosettacode

Robert L Hamilton
In reply to this post by rvjansen
In Jensen's device there is a netRexx and Java code doing the same thing.  My question is;  How does the Java produced by NetRexx compare with the Native Java code?

Bob Hamilton, Engineer
Richardson Texas USA

On Wed, Jul 6, 2011 at 10:14 AM, René Jansen <[hidden email]> wrote:
Alan Sampson has contributed a number of NetRexx examples to http://rosettacode.org/wiki/Category:NetRexx

These will be added to the source code repository to serve both as examples and part of the regression test suite.
I see RossettaCode as an important site for NetRexx because it illustrates that our favourite languages can perform all these tasks with ease, in elegant and terse expression, and in most cases with great performance. More examples here will mean that the language has to be taken seriously, and receives exposure for its strong points. I want to applaud Alan, who decided to spend a part of the US holidays last week to put this together, and I would like to invite you all to have a look, and possibly contribute. Please send in the names of your additions to this list, so I can paste them into the set of examples.

best regards,

René Jansen


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: rosettacode

alansam
In reply to this post by Kermit Kiser


On 6 July 2011 12:00, Kermit Kiser <[hidden email]> wrote:
The arbitrary precision example on RosettaCode needs some work. The first two versions accidentally got the same code posted. And displaying the elapsed time for the calculation does not seem to be part of the other language versions. I would remove that to avoid scaring people! I doubt that many other languages are any better anyway.

- Kermit

Oops!; cut and paste problem.  I've corrected the second one to use the as-advertised BigDecimal class.

Here's the replacement code:
/* NetRexx */
 
options replace format comments java crossref savelog symbols
 
import java.math.BigDecimal
 
numeric digits 30 -- needed to report the run-time
 
nanoFactor = 10 ** 9
 
t1 = System.nanoTime
x = BigDecimal.valueOf(5)
x = x.pow(BigDecimal.valueOf(4).pow(BigDecimal.valueOf(3).pow(2).intValue()).intValue())
n = Rexx(x.toString)
t2 = System.nanoTime
td = t2 - t1
say "Run time in seconds:" td / nanoFactor
say
 
check = "62060698786608744707...92256259918212890625"
sample = n.left(20)"..."n.right(20)
 
say "Expected result:" check
say "  Actual result:" sample
say "         digits:" n.length
say
 
if check = sample
then
 say "Result confirmed"
else
 say "Result does not satisfy test"
 
return

As for scaring people; the RosettaCode project is to demonstrate that a language can accomplish the specified task not, how wonderful any particular language is.  I chose to implement the Rexx version of the task (almost verbatim) to demonstrate that it can be done using language primitives without resorting to the java.math library.  There's no harm in accepting that your language of choice / algorithm of choice isn't necessarily the best way to solve a particular task and there's usually (to paraphrase the Perl mantra) "more than one way to do it" no matter how ill advised that way may be.  Many of the tasks in RosettaCode are very arbitrary and hardly what you'd call "real world" examples.  Just because your language of choice can show warts is no reason to hide them from others, particularly if there's a choice of solutions.

A.
--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Alan

--
Needs more cowbell.
Reply | Threaded
Open this post in threaded view
|

Re: rosettacode

alansam
In reply to this post by rvjansen


On 6 July 2011 11:10, René Jansen <[hidden email]> wrote:

The arbitrary precision example also has some drawbacks - in the NetRexx idiomatic version its performance is indeed atrocious. By giving it two Gigs and running in 64 bit mode I could get it under ten minutes, but I am going to trace around sometime soon, because this is not exactly propaganda either.

Greetings,

By changing:

numeric digits 200000

to:

numeric digits 190000

I've been able to shave approx. 40sec. off the run time on my system.  (Big whoop!)

A.

--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Alan

--
Needs more cowbell.