[erlang-questions] newbie question

Fred Youhanaie <>
Thu Nov 6 20:26:37 CET 2014


and of course the same goes for lst in chunks/2 :)

On 06/11/14 19:09, James Aimonetti wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> str should be Str. Variables start with a capital letter.
>
> Le 2014-11-06 10:56, Charles Hixson a écrit :
>> Given the routine: -module(chunks). -export([chunks/1]).
>> chunks(str)-> chunks(str, []).
>>
>> chunks("", lst)-> list:reverse(lst); chunks(str, lst)-> P1 =
>> "^([[:alnum:]]+|[[:space:]]+|[[:punct:]]+|[[:cntrl:]]+|.)", [[],
>> M1, T1] = re:split(str, P1, [{return, list}]), [M1 | chunks(T1,
>> P1)].
>>
>> and the shell: 47> c(chunks). {ok,chunks}
>>
>> Why do I get: 49> chunks:chunks("Able was I ere I saw Elba."). **
>> exception error: no function clause matching chunks:chunks("Able
>> was I ere I saw Elba.") (chunks.erl, line 15) (Well, forget the
>> like 15.  I took out a bunch of comments.)


More information about the erlang-questions mailing list