1. Computer Language Shootout

I'm adding reverse-complement and partial-sums to the archive. I want to test
them both first.

I notice that reverse-complement opens files for its input and output whereas
the contest specifies stdin/stdout. I can fix that.

Same with partial-sums.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » topic index » view message » categorize

2. Re: Computer Language Shootout

I fixed the partial-sums example. There were a few errors and I changed the meat
of the program to match the FreeBASIC version. Multiplications should be faster
than powers.

I get the proper output but I haven't tested timing yet.

-- partial-sums benchmark (for the Great Programming Shootout)
-- By András Szabó 2007 and Matt Lewis
-- This code is public domain code. You may reuse, redistribute or modify it
-- however you wish.
--
-- about the partial-sums benchmark
-- diff program output N = 25000 with this output file to check your program is 
-- correct before contributing.
-- (Programs may use a single-loop or several-loops; programs may cache
recomputed
-- values in local variables)
-- Each program should use the same naive iterative double-precision algorithms
to
-- calculate partial-sums of the series.

without trace
without warning
without profile

include get.e

sequence argv
object N

argv = command_line()

if length(argv) > 2 then
    N = value(argv[3])
    N = N[2]
else
    N = 0
end if

atom res1, res2, res3, res4, res5, res6, res7, res8, res9
res1 = 0.0
res2 = 0.0
res3 = 0.0
res4 = 0.0
res5 = 0.0
res6 = 0.0
res7 = 0.0
res8 = 0.0
res9 = 0.0

atom temp
atom k2, k3, ksin, kcos, alt
constant tt = 2/3
alt = 1.0

for k=1 to N by 1 do
    k2 = k * k
    k3 = k2 * k
    ksin = sin(k)
    kcos = cos(k)

    res1 += power(tt, k-1)
    res2 += power(k, -0.5)
    res3 += 1 / (k * (k + 1))
    res4 += 1 / (k3 * ksin * ksin)
    res5 += 1 / (k3 * kcos * kcos)
    res6 += 1 / k
    res7 += 1 / k2
    res8 += alt / k
    res9 += alt / (2 * k - 1)
    alt *= -1
    
end for

printf(1,"%.9f\t(2/3)^k",res1)
printf(1,"\n%.9f\tk^-0.5",res2)
printf(1,"\n%.9f\t1/k(k+1)",res3)
printf(1,"\n%.9f\tFlint Hills",res4)
printf(1,"\n%.9f\tCookson Hills",res5)
printf(1,"\n%.9f\tHarmonic",res6)
printf(1,"\n%.9f\tRiemann Zeta",res7)
printf(1,"\n%.9f\tAlternating Harmonic",res8)
printf(1,"\n%.9f\tGregory",res9)


--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Computer Language Shootout

Which web site hosts this shootout? I've found several, but none have Euphoria
included in the results.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Computer Language Shootout

c.k.lester wrote:
> 
> Which web site hosts this shootout? I've found several, but none have Euphoria
> included in the results.

I haven't actually submitted it yet, just to the Euphoria archive.

Shootout page: http://shootout.alioth.debian.org/

I need to find out if someone will make a Debian package or Gentoo ebuild for
Euphoria 3.0. It's a requirement of the contest that the language be open-source
and have a Debian package or Gentoo ebuild. Or be able to build from source in
the standard manner.

Alexander Torreson made a Debian package for 2.5 but that version of Euphoria is
not open-source.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Computer Language Shootout

Jason Gade wrote:
> 
> I need to find out if someone will make a Debian package or Gentoo ebuild for
> Euphoria 3.0. It's a requirement of the contest that the language be
> open-source
> and have a Debian package or Gentoo ebuild. Or be able to build from source
> in the standard manner.
> 
> Alexander Torreson made a Debian package for 2.5 but that version of Euphoria
> is not open-source.

If you grab the source from the svn repository, it will 'build from source
in the standard manner,' which is:

 $ make

Well, it does for me on FC6 with gcc 4.1.  Someone should test with gcc 3.XX.
I don't know if Rob or anyone else has tried it yet.

Matt

new topic     » goto parent     » topic index » view message » categorize

6. Re: Computer Language Shootout

Matt Lewis wrote:
> 
> Jason Gade wrote:
> > 
> > I need to find out if someone will make a Debian package or Gentoo ebuild
> > for
> > Euphoria 3.0. It's a requirement of the contest that the language be
> > open-source
> > and have a Debian package or Gentoo ebuild. Or be able to build from source
> > in the standard manner.
> > 
> > Alexander Torreson made a Debian package for 2.5 but that version of
> > Euphoria
> > is not open-source.
> 
> If you grab the source from the svn repository, it will 'build from source
> in the standard manner,' which is:
> 
>  $ make
> 
> Well, it does for me on FC6 with gcc 4.1.  Someone should test with gcc 3.XX.
> I don't know if Rob or anyone else has tried it yet.
> 
> Matt

Okay. I should probably submit it soon... Hopefully this week.

What I meant by the standard way is ./configure && make && make install Does
Euphoria get installed to /usr/local by default?

Well, they may accept it anyway. Like I said I'll give it a spin this week
sometime.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view message » categorize

7. Re: Computer Language Shootout

Jason Gade wrote:
> 
> 
> Okay. I should probably submit it soon... Hopefully this week.
> 
> What I meant by the standard way is ./configure && make && make install
> Does Euphoria get installed to /usr/local by default?
> 
> Well, they may accept it anyway. Like I said I'll give it a spin this week
> sometime.

You're right.  There's no configure needed, but there's also no install...
The RDS recommended way is to put it in the user's home directory, but 
this isn't a very *nix-y way to do it.

Matt

new topic     » goto parent     » topic index » view message » categorize

8. Re: Computer Language Shootout

I was just checking the reverse-complement program and I didn't get the right
output. The only change I made to the code was removing the reference to a file
so it would read/write to stdin/stdout.

I'll have to look deeper into it.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Computer Language Shootout

I submitted Euphoria as a New Language feature request.

Hopefully they'll accept it. I'll start contributing the programs soon. Everyone
interested, keep your fingers crossed!

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view message » categorize

10. Re: Computer Language Shootout

Just an update--I'm trading messages back and forth with Isaac Gouy who runs the
shootout. He wants to know what is interesting about Euphoria and why it should
be included in the shootout.

If you want to back me up a bit, that would be cool...

http://alioth.debian.org/tracker/index.php?func=detail&aid=304324&group_id=30402&atid=411005

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view message » categorize

11. Re: Computer Language Shootout

Jason Gade wrote:
> 
> Just an update--I'm trading messages back and forth with Isaac Gouy who runs
> the shootout. He wants to know what is interesting about Euphoria and why it
> should be included in the shootout.
> 
> If you want to back me up a bit, that would be cool...
> 
> <a
> href="http://alioth.debian.org/tracker/index.php?func=detail&aid=304324&group_id=30402&atid=411005">http://alioth.debian.org/tracker/index.php?func=detail&aid=304324&group_id=30402&atid=411005</a>

Eu will handle 32-bit integers using atoms. They are stored as double floats
though. I don't know if that fits the criteria or not, but I think so.

Exception handling can basically be done via libraries. Don't know if this would
fit the criteria, as it's a very manual process.

Other than being a fast interpretter, Eu's main feature is sequences.
More specifically, Eu is very good at vector operations.
It also features extensive garbage collection.

My main attraction to Eu was that despite it's simplicity, Eu remains extremely
powerful/flexible. But you already noted that apsect.
On the same vien, Eu has a definitive lack of unnessecary concepts, which I
consider to be a major plus to the language.

Another of my attractions to Eu and one of my main criteria for any language is
that it does NOT contain alot of extraneous, higher-level functionality builtin
such as sockets and hash tables, which seems rather contradictory to the criteria
for the shootout. I'm guessing that they don't actually mean it needs to be
builtin though, just (officially?) supported.


Chris Bensler
~ The difference between ordinary and extraordinary is that little extra ~
http://empire.iwireweb.com - Empire for Euphoria

new topic     » goto parent     » topic index » view message » categorize

12. Re: Computer Language Shootout

Jason Gade wrote:
> 
> Just an update--I'm trading messages back and forth with Isaac Gouy who runs
> the shootout. He wants to know what is interesting about Euphoria and why it
> should be included in the shootout.
> 
> If you want to back me up a bit, that would be cool...
> 
> <a
> href="http://alioth.debian.org/tracker/index.php?func=detail&aid=304324&group_id=30402&atid=411005">http://alioth.debian.org/tracker/index.php?func=detail&aid=304324&group_id=30402&atid=411005</a>
> 
> --
> "Any programming problem can be solved by adding a level of indirection."
> --anonymous
> "Any performance problem can be solved by removing a level of indirection."
> --M. Haertel
> "Premature optimization is the root of all evil in programming."
> --C.A.R. Hoare
> j.


Whats interesting about euphoria?

http://www.rapideuphoria.com/readme.htm

For me, its just so easy to write.

(and because Lua and Python are horrible to look at, but they're in)

Chris

http://euallegro.wikispaces.com
http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/
http://members.aol.com/chriscrylex/EUSQLite/eusql.html

new topic     » goto parent     » topic index » view message » categorize

13. Re: Computer Language Shootout

Chris Bensler wrote:
> Eu will handle 32-bit integers using atoms. They are stored as double floats
> though. I don't know if that fits the criteria or not, but I think so.
Well, yeah. But handling floating point doubles is a separate criteria.


> Exception handling can basically be done via libraries. Don't know if this
> would
> fit the criteria, as it's a very manual process.
> 
> Other than being a fast interpretter, Eu's main feature is sequences.
> More specifically, Eu is very good at vector operations.
> It also features extensive garbage collection.
> 
> My main attraction to Eu was that despite it's simplicity, Eu remains
> extremely
> powerful/flexible. But you already noted that apsect.
> On the same vien, Eu has a definitive lack of unnessecary concepts, which I
> consider to be a major plus to the language.
> 
> Another of my attractions to Eu and one of my main criteria for any language
> is that it does NOT contain alot of extraneous, higher-level functionality
> builtin
> such as sockets and hash tables, which seems rather contradictory to the
> criteria
> for the shootout. I'm guessing that they don't actually mean it needs to be
> builtin though, just (officially?) supported.
It doesn't matter if these concepts are built-in or not but rather that they can
be supported or are supported by libraries at the least. They really aren't
contradictory to the criteria for the shootout but they are "should haves" in
that most modern languages are expected to handle these concepts. They aren't
deal breakers though.

The main question that I'm trying to answer, though, is what makes Euphoria
interesting enough for the Shootout to add it? I know the answer even if I can't
put it into words. After all, it's been my favorite programming language for over
eleven years now (even if I don't personally develop much code).

Anyway, thanks for your input. I don't want to spam their message area but I
just wondered if anyone interested in adding Euphoria to the Shootout had
anything more interesting to say than what I already have.

My main reason is to see Euphoria put its reputation where its mouth is and
really have it compared to these other languages by a disinterested third party.
My secondary reason is to maybe get a little exposure of the language to a larger
audience.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view message » categorize

14. Re: Computer Language Shootout

Chris Burch wrote:
 
> For me, its just so easy to write.
> 
> (and because Lua and Python are horrible to look at, but they're in)

Hi Chris,

How can you group Perl and Python in the same sentence with regard to
readability??

Python is one of the most "readable" and powerful languages ever created.
(and is still my favored language to use)

Regards,

Ray Smith
http://RaymondSmith.com

new topic     » goto parent     » topic index » view message » categorize

15. Re: Computer Language Shootout

Ray Smith wrote:
> 
> Chris Burch wrote:
>  
> > For me, its just so easy to write.
> > 
> > (and because Lua and Python are horrible to look at, but they're in)
> 
> Hi Chris,
> 
> How can you group Perl and Python in the same sentence with regard to
> readability??
> 
> Python is one of the most "readable" and powerful languages ever created.
> (and is still my favored language to use)
> 

smile

Sorry Ray, didn't realise Lua was Perl. Have experimented with them, just not my
cup
of tea. One mans meat and all that.

Chris

> Regards,
> 
> Ray Smith
> <a href="http://RaymondSmith.com">http://RaymondSmith.com</a>

new topic     » goto parent     » topic index » view message » categorize

16. Re: Computer Language Shootout

Jason Gade wrote:
> 
> I was just checking the reverse-complement program and I didn't get the right
> output. The only change I made to the code was removing the reference to a
> file
> so it would read/write to stdin/stdout.
> 
> I'll have to look deeper into it.

Never mind. The output is correct my testing method was wrong.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view message » categorize

17. Re: Computer Language Shootout

Jason Gade wrote:
> 
> I submitted Euphoria as a New Language feature request.
> 
> Hopefully they'll accept it. I'll start contributing the programs soon.
> Everyone
> interested, keep your fingers crossed!

Well, it doesn't look like Isaac is interested in adding Euphoria to the
Shootout so I'll have to figure out how to do the tests myself.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view message » categorize

18. Computer Language Shootout

I just recently learned about the Great Computer Language Shootout Benchmarks
at:

http://shootout.alioth.debian.org/great/

Why don't a bunch of Euphorians get together and submit the various programs for
this comparison.  I think it would attract attention to Euphoria to see how fast
it runs.

Brent

new topic     » goto parent     » topic index » view message » categorize

19. Re: Computer Language Shootout

Brent W. Hughes wrote:
> 
> 
> I just recently learned about the Great Computer Language Shootout Benchmarks
> at:
> 
> <a
> href="http://shootout.alioth.debian.org/great/">http://shootout.alioth.debian.org/great/</a>
> 
> Why don't a bunch of Euphorians get together and submit the various programs
> for this
> comparison.  I think it would attract attention to Euphoria to see how fast it
> runs.
> 
> Brent
> 

Hey... that sounds like a great idea. Euphoria 2.5 has the fastest execution of
any release, and v3.0 will likely be slightly faster executing, and hopefully
faster loading too (which is an issue with v2.5 with it's entire parse before run
& euphoria translated to C front-end). A more optimized Euphoria front-end will
likely help this more. Anyway I would like to see the results, in a whole bunch
of different benchmark tests, not just sieve.

Regards,
Vincent

----------------------------------------------
     ___	      __________      ___
    /__/\            /__________\    |\ _\
    \::\'\          //::::::::::\\   |'|::|
     \::\'\        //:::_::::_:::\\  |'|::|
      \::\'\      //::/  |::|  \::\\ |'|::|
       \::\'\    //::/   |::|   \::\\|'|::|
        \::\'\__//::/    |::|    \::\|'|::|
         \::\','/::/     |::|     \::\\|::|
          \::\_/::/      |::|      \::\|::|
           \::,::/       |::|       \:::::|
            \___/        |__|        \____|

 	                 .``.
		         ',,'

new topic     » goto parent     » topic index » view message » categorize

20. Re: Computer Language Shootout

Brent W. Hughes wrote:
> 
> 
> I just recently learned about the Great Computer Language Shootout Benchmarks
> at:
> 
> <a
> href="http://shootout.alioth.debian.org/great/">http://shootout.alioth.debian.org/great/</a>
> 
> Why don't a bunch of Euphorians get together and submit the various programs
> for this
> comparison.  I think it would attract attention to Euphoria to see how fast it
> runs.
> 
> Brent
> 

Uhm... isn't that what RDS is using to boast it's performance in your very own
EUPHORIA\DEMO\bench\ directory?

What?  You want more than one benchmark to validate the efficiency of the
language?

-- Brian

new topic     » goto parent     » topic index » view message » categorize

21. Re: Computer Language Shootout

Brent W. Hughes wrote:
> 
> 
> I just recently learned about the Great Computer Language Shootout Benchmarks
> at:
> 
> <a
> href="http://shootout.alioth.debian.org/great/">http://shootout.alioth.debian.org/great/</a>
> 
> Why don't a bunch of Euphorians get together and submit the various programs
> for this
> comparison.  I think it would attract attention to Euphoria to see how fast it
> runs.


The Ackermann test...

-- The Computer Language Shootout Benchmarks
--   http://shootout.alioth.debian.org/
--
--   contributed by Derek Parnell
--
--   run: exu ackermann.ex N

include get.e
function Ack(integer M, integer N) 
    if M = 0 then
        return N+1
    elsif N = 0 then
        return Ack(M-1,1)
    end if
    return Ack(M-1, Ack(M, N-1))
end function

procedure main(sequence argv)

    object v
    integer n
    if length(argv) > 2 then
      v = value(argv[3])
      n = v[2]
    else
      n = 1
    end if

    printf(1, "Ack(3,%d): %d\n", {n, Ack(3, n)})
end procedure

main(command_line())


-- 
Derek Parnell
Melbourne, Australia
irc://irc.sorcery.net:9000/euphoria

new topic     » goto parent     » topic index » view message » categorize

22. Re: Computer Language Shootout

Brent W. Hughes wrote:
> 
> 
> posted by: Brent W. Hughes <bwh566 at yahoo.com>
> 
> 
> I just recently learned about the Great Computer Language Shootout Benchmarks
> at:
> 
> http://shootout.alioth.debian.org/great/
> 
> Why don't a bunch of Euphorians get together and submit the various programs
> for this comparison.  I think it would attract attention to Euphoria to see how
> fast it runs.
> 
> Brent

I'd considered doing it, but then I didn't.  I think it would be a great 
idea, though.

One problem with actually submitting to the site, though, is that the 
require the language to be open-source.  Now Euphoria is quasi-open 
source so I don't know how that would work.  You could submit the PD 
version of the language compiled with GCC but then the performance would 
be 8-10x slower.

I'm perpetually lazy, so I haven't done it, but I think for Euphoria it 
would be worthwhile to write the benchmarks and then compare 2.4 to 2.5 
to 2.5 double-interpreted and then use C or D as the baseline to compare 
against.

I noticed that D compares very favorably with other languages and I 
think all of the benchmarks are complete.

-- 
==============================
Too many freaks, not enough circuses.
j.

new topic     » goto parent     » topic index » view message » categorize

23. Re: Computer Language Shootout

I've just read a little more at the Shootout site.  And I quote:

----------------------------------------------------------------
Why don't you include language X?

Programming languages that can be used to write most of our benchmark programs!

Must have

1. A Debian package (either from Debian itself, or the primary authors of the
   language.)
Or build and install with ./configure && make && make install and a
      default target of /usr/local.
   2. Documentation.
   3. Command-line argument handling.
   4. 32-bit Integers.
   5. Double precision floating point numbers.
   6. Dynamic hash tables and sequences (arrays or lists).
   7. Line-oriented read & write from stdin & stdout.

Should have

   1. Buffered stdio.
   2. Exception handling.
   3. Regular Expressions (preferably Perl compatible).
   4. Concurrency (threads, coroutines, …)
   5. TCP/IP Sockets.
   6. Object-oriented programming features.

Why don't you include language X?

Is the language …

1. Free? The hope is that people who come across the shootout will be
   motivated to learn a new language, and since the barriers to learning a new
   language are far lower for a free implementation, those are the prefered
   languages for display. While commercial languages are not officially
   disqualified, there do not seem to be many compelling reasons to include them.
2. Open source? Programming languages should be open source. As language
   users, when we find a problem but do not have access to the source code it is
   very frustrating. If you have ever had to maintain production software for a
   compiler that is no longer available from a vendor, with no available bug fixes,
   you'll understand this preference.
   3. Used? There are way too many dead languages and unused new languages.
4. Interesting? Is there something significant and interesting about the
   language that will be revealed by these simple benchmark programs?

We will accept and reject languages in a capricious, unfair, biased fashion.

---------------------------------------------------------------------

Well, we don't fit all the requirements, but since their decisions are
"capricious", maybe we still have a chance.

Should we just start writing the benchmark programs and then submit Euphoria
together with about 15 benchmarks and see what happens?

Rob has already done the Sieve program and Derek has done Ackermann.  Anyone
else want to submit?

Go to the shootout page
(http://shootout.alioth.debian.org/great/index.php?sort=fullcpu) to see what's
available.

Brent

P.S.  If you decide to write one, post it here so that we won't have a
duplication of effort.

new topic     » goto parent     » topic index » view message » categorize

24. Re: Computer Language Shootout

Here is the entry for binary trees.  I pretty much copied the C/C#
implementation almost verbatim.  I don't know if I can make it any more
"Euphoria" though.

I also used Derek's ackermann.ex as a template.

The good news is it worked right the first time (pats self on back).

-- The Computer Language Shootout Benchmarks
--  http://shootout.alioth.debian.org/
-- 
--  by Jason Gade
--  run: exu binary-trees.ex N

include get.e 



constant LEFT =  1,
         RIGHT = 2,
         ITEM =  3
         
constant NULL = {} 



function ItemCheck(sequence tree)

    if equal(tree[LEFT], NULL) then 
        return tree[ITEM]
    else 
        return tree[ITEM] + ItemCheck(tree[LEFT]) - ItemCheck(tree[RIGHT])

    end if

end function -- ItemCheck



function BottomUpTree(atom item, integer depth)

    if depth > 0 then
        return {BottomUpTree(2 * item - 1, depth - 1), 
                BottomUpTree(2 * item, depth - 1),
                item}
    else
        return {NULL, NULL, item}
    
    end if
end function -- BottomUpTree



procedure main(sequence argv)

    atom iterations, check
    integer N, minDepth, maxDepth, stretchDepth
    sequence v, stretchTree, longLivedTree, tempTree

    if length(argv) > 2 then
        v = value(argv[3])
        N = v[2]
    else
        N = 0
    end if

    minDepth = 4

    if (minDepth + 2) > N then
        maxDepth = minDepth + 2
    else
        maxDepth = N
    end if

    stretchDepth = maxDepth + 1

    stretchTree = BottomUpTree(0, stretchDepth)
    printf(1, "stretch tree of depth %d\t  check: %d\n",
              {stretchDepth,
              ItemCheck(stretchTree)})

    stretchTree = {} 

    longLivedTree = BottomUpTree(0, maxDepth)

    for depth = minDepth to maxDepth by 2 do

       iterations = power(2, maxDepth - depth + minDepth)

       check = 0

       for i = 1 to iterations do

           tempTree = BottomUpTree(i, depth)
           check += ItemCheck(tempTree)
           tempTree = {}

           tempTree = BottomUpTree(-i, depth)
           check += ItemCheck(tempTree)
           tempTree = {}

       end for -- i

        printf(1, "%d\t  trees of depth %d\t  check: %d\n",
                  {iterations * 2, depth, check })

    end for -- depth

    printf(1, "long lived tree of depth %d\t  check: %d\n",
              {maxDepth, ItemCheck(longLivedTree)})

end procedure -- main



main(command_line())
-- end binary-trees.ex


The problem is sometimes I have a more difficult time understanding the
specification than I do the code.  Which is weird because I am not very good at
reading source code, especially that which is basically uncommented like the
shootout code is.

Are real-world specifications this vague?

I remember Derek's contest from last year, the specifications were very clear
with the exception of hashing (no pun) out some specifics on some details.

=====================================
Too many freaks, not enough circuses.

j.

new topic     » goto parent     » topic index » view message » categorize

25. Re: Computer Language Shootout

I did the word count portion and put it on the uploads 
http://www.rapideuphoria.com/uploads/wc.zip

It contains wc.ex which should act like the shootout page says it 
should.  It takes its input from stdin.  Since I'm using Windows XP, 
though, I think stdin swallows up \r and it doesn't count correctly. 
Hopefully someone can tell me if it works right on *nix.

I wrote wc2.ex which takes a filename on the command line and handles \r 
correctly under DOS/Windows.

The shootout page for wc shows a different char count, but I think their 
page is in error.  My program prints out 6092 as the char count and that 
is also what is listed as the program size in dir.

I found the newline error by downloading a text version of Hamlet and 
that's why I wrote wc2.ex.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu