[erlang-questions] how to make beautifulll code of this working code

Garrett Smith g@REDACTED
Mon Aug 10 21:15:16 CEST 2015

On Mon, Aug 10, 2015 at 1:38 PM, Joe Armstrong <erlang@REDACTED> wrote:
> On Mon, Aug 10, 2015 at 7:25 PM, Garrett Smith <g@REDACTED> wrote:
>> Personally I find the Erlang docs excellent, so this:
>> http://erlang.org/doc/man/re.html#split-2
>> Roelof, I recommend that you spend some cycles reading these as a
>> matter of course when you're using a function. The docs will help you
>> get things right and you'll start to absorb some Erlang zen. The list
>> is great to help after you've done that and still have questions.
> My goodness reading the manual first. I thought this was the
> only done when evoking the "if all else fails read the friendly manual bit"
> I usually poke around in the shell first.
> Not having a clue how re:split worked I guessed and tried this:
>> re:split("2015-08-06","-").
> [<<"2015">>,<<"08">>,<<"06">>]
> One wild guess later (and some distant memory) I tried
>> re:split("2015-08-06","-"),[{return,list}].
> ["2015","08","06"]
> Life is too short to waste it reading manual pages - or is it the other way
> around - life is too short to waste it by not reading manual pages - I
> can'tmake my mind up

So now I'm wondering how much tinkering's required to reverse engineer
the docs on the third argument to re:split/3 ;)

I'm always looking up function docs, for which args come when (they
tend to be different, wildly) and options. erlang.org/doc/man is a
very important resource and it'll answer a lot of questions for you.

Of course the shell is indispensable for playing around with the
functions - but life is much easier if you have an idea how to use
them in the first place.

More information about the erlang-questions mailing list