[erlang-questions] escript cutting output

Tim Watson watson.timothy@REDACTED
Sat Nov 19 02:26:10 CET 2011


You forgot the most important line:

%% Example: http://xkcd.com/386/

Perhaps, like me, you were typing on a phone whilst standing on a crowded
train.

On 19 November 2011 00:29, Bob Gustafson <bobgus@REDACTED> wrote:

> After spending too much time learning Erlang over the last few hours, I
> think I have come up with a 'solution' to Matthias' well posed example
> script. See below.
>
> #!/usr/bin/env escript
>   main(_) ->
>    S = self(),
>    spawn_link(fun() ->
>       io:format("~p~p~n", [lists:duplicate(100000, $a), b]),
>        io:format(""), %**
>        S ! finished
>    end),
>    receive
>      finished ->
>           io:format(""), %**
>           halt(0);
>      _Other ->
>          halt(1)
>    end.
>
> This script emits a string which *does* end in 'b'.
>
> If you comment out either of the added lines followed by %**, then it
> will emit a shorter string not ending in 'b'.
>
> Bob G
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111119/d0a4c3fa/attachment.htm>


More information about the erlang-questions mailing list