[erlang-questions] what's happened in the shootout

Bengt Kleberg bengt.kleberg@REDACTED
Tue Jun 19 15:02:03 CEST 2007


...deleted
> Do you think programs like this one would be
> accepted in the shootout?
> 
> -module(sumcol).
> -export([main/1]).
> -export([start/0]).
> 
> %% get the program argument, which is how many test iterations to run
> %% for this test, we ignore this parameter
> main(_Args) ->
>     user ! {self(), wait_ready},
>     receive
> 	ready ->
> 	    halt()
>     end.
> 
> %% callback function for custom user process
> start() ->
>     spawn(fun() ->
> 		  process_flag(priority,high),
> 		  register(user, self()),
> 		  read_in(open_port({fd,0,1}, [{line,80},eof]), 0)
> 	  end).
> 
> read_in(Port, Sum) ->
>     receive
> 	{Port, {data, {Eol, Str}}} when Eol==eol; Eol==noeol->
>           read_in(Port, Sum + list_to_integer(Str));
> 	{Port, eof}  ->
> 	    ready(Port, Sum)
>     end.
> 
> ready(Port, Sum) ->
>     port_command(Port, [integer_to_list(Sum), "\n"]),
>     erlang:port_close(Port),
>     receive
> 	{From, wait_ready} ->
> 	     From ! ready
>     end.

...deleted
> 
> It does say that "Programs should use built-in line-oriented I/O functions rather than custom-code", but arguably, this program does exactly that.

you are allowed to suggest the change, but i would not expect it to get 
admitted.


bengt
-- 
Those were the days...
    EPO guidelines 1978: "If the contribution to the known art resides
    solely in a computer program then the subject matter is not
    patentable in whatever manner it may be presented in the claims."



More information about the erlang-questions mailing list