<p>Yes, but there is no way to define your own guards that will be treated by the erlang compiler as such (correct me if I'm wrong), while in haskell you can define a side effect free function, and the compiler will recognize a function prevent you from introducing side effects into said function.</p>

<p>In erlang, you can't use user defined functions in guards (because erlang doesn't check side effects in compilation afaik), but if erlang did support done kind of "guaranteed side effect free function definition", then that would perhaps be a road to allowing user defined functions in guards.</p>

<p>--<br>
Jesse Gumm<br>
Owner, Sigma Star Systems<br>
414.940.4866<br>
<a href="http://www.sigma-star.com">www.sigma-star.com</a><br>
@jessegumm</p>
<div class="gmail_quote">On Jan 20, 2012 1:31 PM, "Michael Truog" <<a href="mailto:mjtruog@gmail.com">mjtruog@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<u></u>

  
    
  
  <div bgcolor="#ffffff" text="#000000">
    On 01/20/2012 10:46 AM, Tom Murphy wrote:
    <blockquote type="cite">
      
      <p>On Jan 20, 2012 1:39 AM, "Ahmed Al-Saadi" <<a href="mailto:thaterlangguy@gmail.com" target="_blank">thaterlangguy@gmail.com</a>>
        wrote:<br>
        > If you want a pure functional language, look at Haskell. A
        good indication that a programming language is purely functional
        is its use of monads.<br>
        ></p>
      <p>Monads are a way of "interfacing" between pure and impure code,
        so in a sense this is true, but many languages (like OCaml?)
        bridge the divide differently. In its essence, having pure
        functons simply means being able to define functions which are
        unable to perform side-effects. So Erlang could add support for
        pure functions, without really needing to change anything else
        within the language.<br>
      </p>
    </blockquote>
    Erlang already has pure functions that are called "guards" (these
    functions do not create side-effects).<br>
  </div>

<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div>