erlang

How far should I take referential transparency?

I am building a website using erlang, mnesia, and webmachine. Most of the documentation I have read praises the virtues of having referentially transparent functions. The problem is, all database access is external state. This means that any method that hits the database is no longer referentially transparent. Lets say I have a user ob...

Erlang and Java interfacing

I am particularly interested in knowing the performance implications of the Erlang component when doing this kind of interfacing. After learning about Erlang I thought that it might be useful to code certain components of an application in Erlang where I need to use the high concurrency and throughput that it provides. Has any one tried...

Vim settings for Erlang

Does anyone want to share their erlang vim settings? It seems I can't make it work at all and the worst part is that it doesn't auto-indent automatically. Is there something outhere called vim-erlang, as in vim-python or something? ...

Convert clause to a Fun

How to represent this clause in one line using Fun. perms([]) -> [[]]; perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])]. ...

Erlang Ets tables between Nodes

I've got an ejabberd server with a good amount of custom modules running. I have several mnesia tables and I know these can be easily copied between nodes without any change to the code at all. I was wondering if there's a similar way with ets tables? Ideally it'd be nice to be able to have several machines running with exactly the sa...

How to push Erlang to my workplace

I think Erlang is very well suited for server systems developed in my workplace (currently developed in Java). I am a bit skeptical how this would be accepted both by developers (who have no idea about functional or Erlang) and by managers. Any ideas on how to approach the issue? I am thinking about some hybrid system, where the hard...

Is there an idiomatic way to order function clauses in Erlang?

For functions where the ordering of the clauses is unimportant, is it base case last: all(Pred, [Head|Tail]) -> case Pred(Head) of true -> all(Pred, Tail); false -> false end; all(Pred, []) when is_function(Pred, 1) -> true. Or base case first: all(Pred, []) when is_function(Pred, 1) -> true; all(Pred, [Head|Tail]) -> c...

Is there an idiomatic way to order function arguments in Erlang?

Seems like it's inconsistent in the lists module. For example, split has the number as the first argument and the list as the second, but sublists has the list as the first argument and the len as the second argument. ...

"Bundling" external libraries in Erlang?

I have an erlang application I have been writing which uses the erldis library for communicating with redis. Being a bit of a newbie with actually deploying erlang applications to production, I wanted to know if there was anyway to 'bundle' these external libraries with the application rather than installing into my system wide /usr/lib...

Lisp Flavored Erlang - Messaging primitives

I've read through all the documentation, and most of the source of LFE. All the presentations emphasize basic lisp in traditional lisp roles - General Problem Solving, Hello world and syntax emulating macros. Does anyone know how LFE handles messaging primitives? To specify a more precise question, how would you express this erlang: ...

Sending binaries in Erlang over TCP

Using the code below to send. The gen_tcp:send call returns {error,einval} but I can't figure out why... -define(TCP_OPTIONS,[binary, {active, false}, {reuseaddr, true}]). client() -> case gen_tcp:connect(to_Server(), 8080, ?TCP_OPTIONS) of {error, Reason} -> io:format("~p~n",[Reason]); {ok,My_Socket} -> Message ...

Considering an Erlang web framework to learn and use in production

I’ve started learning Erlang a few days ago and it’s definitely a very interesting language and very suitable for web development (back end at least). I am going to experiment and eventually settle with one Erlang web framework to use for my next project. Since Erlang is “new” is kind of hard to decide which framework to use (i.e. lack o...

Erlang compilation - Erlang as stand alone executeable

is there a way to compile Erlang to be a stand-alone executable? this means, to run it as an exe without the Erlang runtime. thanks ...

Comet app over REST in erlang ?

Hi, I am a newbie to Erlang and am trying to make a switch to Erlang for our latest project. Since this is going to be a real-time chat (long polled) system for file sharing on the fly, I realized after a bit of digging around that Erlang would be the most appropriate choice, because of high concurrency, plus people also suggested to use...

Where can I find erlang programming reference?

Is there a programming reference in erlang like java api docs? I have searched in google but did not find anything. ...

Concurrency: how does shared memory vs message passing handle large data structures?

In looking at Go and Erlang's approach to concurrency, I noticed that they both rely on message passing. This approach obviously alleviates the need for complex locks because there is no shared state. However, consider the case of many clients wanting parallel read-only access to a single large data structure in memory -- like a suffix...

Why does not init:stop() terminate directly?

My code for display all days in this year. I don't understand why if NewSec =< EndSec -> init:stop() end did not execute the first time in run_calendar? I expect init:stop() could be executed first time but it is not. What is wrong? Code: -module(cal). -export([main/0]). main() -> StartSec = calendar:datetime_to_gregorian_se...

Riak on Windows

I want to play with Riak http://riak.basho.com/ or a least get it running on a Windows system. I have downloaded the source code and compiled it but that's where I get stuck, how do I start it? ...

Erlang: is there a module analogous to Python "webbrowser" ?

I've used Python webbrowser module and I would love something equivalent in Erlang. What I am trying to do is open a browser window/tab from Erlang. I can't find anything in the official Erlang documentation. Is there such a thing? ...

What does the "head mismatch" compiler error mean?

I tries to write code to print Z character. zzzzzzz z z z z z zzzzzzz But when I compile this code, it throws D:\erlang\graphics>erlc zeez2.erl d:/erlang/graphics/zeez2.erl:19: head mismatch d:/erlang/graphics/zeez2.erl:6: function zeez/3 undefined I can't fixed this error. I didn't find what wrong in my could. Doe...