<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<div class="moz-cite-prefix">On 11/06/2014 11:58 AM, Erik Søe
Sørensen wrote:<br>
</div>
<blockquote
cite="mid:CAO1s=UV+8C6PNXM7P1bN8u+PQ7kbKROBWky6bCc5q-NXj6H1Rw@mail.gmail.com"
type="cite">
<div dir="ltr">
<p>Hi there -</p>
<p>Apart from the atom-vs-Variable issue, I think you got your
recursion wrong.</p>
<p> [M1 | chunks(T1,
P1)]</p>
<p>doesn't make too much sense (that I can see) - especially the
"recurse with P1 for Lst" part.</p>
<p>I think you mean either</p>
<p> chunks(T1, [M1|Lst])</p>
<p>for a tail recursive loop, or</p>
<p> chunks("") -> [];</p>
<p> chunks(Str) -> ..., [M1 | chunks(T1)]</p>
<p>for "normal" recursion on the rest. At present, you code
looks like a confusion of the two (apart from the Lst/P1
difference).</p>
<p><br>
</p>
<p>Regards, and have fun on the learning curve,<br>
</p>
<p>Erik<br>
</p>
<p><br>
</p>
<div class="gmail_quote">Den 06/11/2014 20.27 skrev "Fred
Youhanaie" <<a moz-do-not-send="true"
href="mailto:fly@anydata.co.uk" target="_blank">fly@anydata.co.uk</a>>:<br
type="attribution">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"><br>
and of course the same goes for lst in chunks/2 :)<br>
<br>
On 06/11/14 19:09, James Aimonetti wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
str should be Str. Variables start with a capital letter.<br>
<br>
Le 2014-11-06 10:56, Charles Hixson a écrit :<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
Given the routine: -module(chunks). -export([chunks/1]).<br>
chunks(str)-> chunks(str, []).<br>
<br>
chunks("", lst)-> list:reverse(lst); chunks(str,
lst)-> P1 =<br>
"^([[:alnum:]]+|[[:space:]]+|[[:punct:]]+|[[:cntrl:]]+|.)",
[[],<br>
M1, T1] = re:split(str, P1, [{return, list}]), [M1 |
chunks(T1,<br>
P1)].<br>
<br>
and the shell: 47> c(chunks). {ok,chunks}<br>
<br>
Why do I get: 49> chunks:chunks("Able was I ere I saw
Elba."). **<br>
exception error: no function clause matching
chunks:chunks("Able<br>
was I ere I saw Elba.") (chunks.erl, line 15) (Well,
forget the<br>
like 15. I took out a bunch of comments.)<br>
</blockquote>
</blockquote>
_______________________________________________<br>
erlang-questions mailing list<br>
<a moz-do-not-send="true"
href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a moz-do-not-send="true"
href="http://erlang.org/mailman/listinfo/erlang-questions"
target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
</blockquote>
Thank you much (all of you!).<br>
Using upper case of "variables" is going to take a bit of learning.<br>
</body>
</html>