[erlang-questions] escript cutting output

Bob Gustafson bobgus@REDACTED
Sat Nov 19 07:00:23 CET 2011


Yes, I agree. That cartoon sums up my motivation..

On Sat, 2011-11-19 at 01:26 +0000, Tim Watson wrote:
> 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
>         
> 





More information about the erlang-questions mailing list