Formatting style?

Shawn Pearce spearce@REDACTED
Wed Jan 3 04:30:24 CET 2001


Hey, I'm just curious, how do the ``expert'' Erlang programmers
format this code:

trade_with_agent(Agent, #trade_task{mode=buy, market=Market}, Bid) ->
	Seller = Market:bid_agent_id(Bid),
	Id = make_trade(Agent, Seller, Market, Bid),
	io:format("Agent ~p buy in ~p~n", [agent:id(Agent), Id]),
	agent:send(Seller, {trade, buy, Id});
trade_with_agent(Agent, #trade_task{mode=sell, market=Market}, Bid) ->
	Buyer = Market:bid_agent_id(Bid),
	Id = make_trade(Buyer, Agent, Market, Bid),
	io:format("Agent ~p sell in ~p~n", [agent:id(Agent), Id]),
	agent:send(Buyer, {trade, sell, Id}).

I find it difficult to read that they are the same function, just
different varients of trade_with_agent/4.

I'm just talking about white space and formatting conventions, however
comments about the function's arguments are certainly welcome as well.

--
Shawn.

  ``If this had been a real
    life, you would have
    received instructions
    on where to go and what
    to do.''



More information about the erlang-questions mailing list