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

Roelof Wobben r.wobben@REDACTED
Mon Aug 10 18:09:38 CEST 2015


Op 10-8-2015 om 17:59 schreef Garry Hodgson:
> date_parts(Date) ->
>     [list_to_integer(N) || N <- string:tokens(Date,"-")]. 

When testing I see this output:

2> dates:date_parts("2012-02-02").
  ** exception error: bad argument in function list_to_integer/1 called 
as list_to_integer(<<"2012">>) in call from 
dates:'-date_parts/1-lc$^0/1-0-'/1 (dates.erl, line 6)

---
Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
https://www.avast.com/antivirus




More information about the erlang-questions mailing list