[erlang-questions] Does Erlang pure functional programming language?

Jesse Gumm gumm@REDACTED
Fri Jan 20 21:08:28 CET 2012


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.

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.

--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866
www.sigma-star.com
@jessegumm
On Jan 20, 2012 1:31 PM, "Michael Truog" <mjtruog@REDACTED> wrote:

> **
> On 01/20/2012 10:46 AM, Tom Murphy wrote:
>
> On Jan 20, 2012 1:39 AM, "Ahmed Al-Saadi" <thaterlangguy@REDACTED> wrote:
> > 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.
> >
>
> 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.
>
> Erlang already has pure functions that are called "guards" (these
> functions do not create side-effects).
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120120/b777e2f9/attachment.htm>


More information about the erlang-questions mailing list