The Great Computer Language Shootout is back

Bengt Kleberg bengt.kleberg@REDACTED
Mon Jun 28 13:38:36 CEST 2004

>> Am Fri, 25 Jun 2004 09:01:25 -0500 hat
>> James Hague <jamesh@REDACTED> geschrieben:
>>> Someone else picked it up:
>>> If there are changes to the Erlang benchmarks you've been sitting 
>>> on, go
>>> ahead and submit them.

i have sent a wc.erl (see below). it is really simple, but perhaps 
something faster is avaliable?

many years ago i re-wrote all the benchmarks that used 
erlang:open_port() to use the io module for their io. due to bad timing 
they where done after the shootout moved to windows. for some reason the 
io module will not work with redirected stdin on windows. so all the my 
benchmarks failed to run. some time after that i changed jobs and lost 
track of them.

they where very simple and i will re-create them, as i have with wc.erl, 
when times permits. perhaps they will work and be accepted for this 


-export([main/0, main/1]).

main() -> main(['1']).
main(_Args) ->
    wc(io:get_line(''), 0, 0, 0),

wc(eof, Newlines, Words, Characters) ->
    io:format("~w ~w ~w~n", [Newlines, Words, Characters]);
wc(Line, NL, NW, NC) ->
    Words = string:tokens(Line, " \t\n"),
    wc(io:get_line(''), NL + 1, NW + string:len(Words), NC + 
string:len(Line) ).

More information about the erlang-questions mailing list