[erlang-questions] newbie question

James Aimonetti <>
Thu Nov 6 20:09:03 CET 2014


-----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.) 
> _______________________________________________ erlang-questions
> mailing list  
> http://erlang.org/mailman/listinfo/erlang-questions
> 
> 


- -- 
James Aimonetti
Lead Systems Architect / Impressionable Scallywag
"I thought I fixed that"

2600Hz | http://2600hz.com
sip:
tel:415.886.7905
irc:mc_ @ freenode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJUW8dPAAoJENTKa+JPXCVgv6UH/Ailn5lOqGv3JWQM9P7FfcYs
VM4Ig0/aRhc+qdfUhwIkOj/gimczq0KnnJcImX9aIuJ7kykkGV/B4aLQHLqqaxFN
5xIU6JIohS7TIgSoesAKWkq4DcMoFVUrVkTHWqBb7hTotWeZSoyy6daVBurkYZs8
omd27lVeQ1Oz8nDHU/y1YhqCJsL9U4qk3VGFLQjv8J9MrWNYsBcAtuMJqWcsV0NW
BqnAMcK1ERLq5Sn30pJ1Ap4tzR6yZfI2pMcyN0uo5F8pdJYtdZUwS1Hg4D2cuL7R
/jsTgCRfbLHTRJEcI160ROWGzx7DtHnoZtoLDpc9Cfq/O1CGKXklNrbG7mOM4Z4=
=0Vrm
-----END PGP SIGNATURE-----


More information about the erlang-questions mailing list