said(_Req) -> form(fun(Data) -> link(["you said: ", arg(Data, "foo")], "click here") end, input("foo"), submit()).
The main different is that Erlang doesn't have syntactic sugar for a single-variable lambda function. However, the total number of tokens is almost the same.
Maybe I'll take some ideas from Arc and use them in ErlyWeb :) Thanks for the illuminating example -- I've never seen this kind of programming style before.
handle(_, [{said, Value}|_]) ->
{Value, {ehtml, {a, [{href, self}], "click me"}}};
handle(S, [_|R]) ->
handle(S, R);
handle([], []) ->
{[], {ehtml, {form, [{action, self}],
[{input, [{type, "text"},
{name, "said"}, {size, 50}], []},
{input, [{type, "submit"}]}]}}};
handle(S, []) ->
{S, {ehtml, {p, [], io_lib:format("you said: ~s", [S])}}}.
Like many of the other examples, it's lacking the clever HTML generation.-----