<div><br></div><div>Once more with feeling :(</div><div><br></div><div>check(UName, Email, Pwd) -></div><div>  Fun = f({_, _, X}) -> X end,</div><div>  List = [{email, in_use, is_in_use_e(Email},</div><div>             {UName, not_valid, not_valid(UName)},</div>
<div>             {UName, in_use, is_in_use_u(UName)},</div><div>             {Pwd, not_suitable, is_not_strong(Pwd)}],</div><div>lists:filter(Fun, List).</div><div><br></div><div>Gordon</div><br><br><div class="gmail_quote">
On Fri, Mar 20, 2009 at 1:31 PM, Gordon Guthrie <span dir="ltr"><<a href="mailto:gordon@hypernumbers.com">gordon@hypernumbers.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Sorry, pressed send too soon by mistake - this doesn't answer your question...<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Fri, Mar 20, 2009 at 1:30 PM, Gordon Guthrie <span dir="ltr"><<a href="mailto:gordon@hypernumbers.com" target="_blank">gordon@hypernumbers.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ryegug<div><br></div><div>How about a single conditional on a tuple?</div><div><br></div><div>check(Email, Username, Password) -></div>

<div>     InUseE = check_in_use_email(Email),</div><div>     AlphaNum = check_is_alphanumeric(Username),</div>
<div>    InUseU = check_in_use_username(Username),</div><div>   StrongEnough = check_password(password),</div><div><br></div><div> case {InUseE, AlphaNum, InUseU, StrongEnough} of</div><div>     {true, true, true, true} -> true;</div>


<div>     _                             -> false</div><div>end.<div><div></div><div><br><br><div class="gmail_quote">On Fri, Mar 20, 2009 at 1:20 PM, ryeguy <span dir="ltr"><<a href="mailto:ryeguy1@gmail.com" target="_blank">ryeguy1@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So when a user sends a request to register an account, they send their<br>
username, password, email, and other info. The registration function<br>
must verify all of their data. An example would be:<br>
<br>
 - verify email not in use<br>
 - verify username not in use<br>
 - verify username is alphanumeric<br>
 - verify all fields are above X characters long<br>
 - verify all fields are less than Y characters long<br>
<br>
Now I don't want to have a 5 level deep if or case statement, but what<br>
other options do I have? Splitting it into separate functions sounds<br>
like a good idea, but then I just have to check the return value of<br>
the functions in some sort of conditional and it's back to the<br>
original problem.<br>
<br>
I could separate them into functions and then call an if statement<br>
with all of the conditionals OR'd together, but that wouldn't give me<br>
what I want because I need to be able to tell the user the specific<br>
error if there was one.<br>
<br>
How does one handle this kind of situation in erlang?<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br></div></div></div>
</blockquote></div><br>
</div></div></blockquote></div><br>