Hi,
I am really struggling to understand tail recursion in Erlang.
I have the following eunit test:
db_write_many_test() ->
Db = db:new(),
Db1 = db:write(francesco, london, Db),
Db2 = db:write(lelle, stockholm, Db1),
?assertEqual([{lelle, stockholm},{francesco, london}], Db2).
And here is my implementation:
-module(...
Hi, I'm trying to start erlang slave node on cluster and I receive "bash: erl: command not found" message. Though I have alias for erl. Here is what I actually do:
[user@n001 ~]$ erl -rsh ssh -sname n001
Eshell V5.7.5 (abort with ^G)
(n001@n001)1> slave:start_link("user@n002", n002, "-rsh ssh").
bash: erl: command not found...
Hi,
I am trying to get my head round some basic erlang functionality and I could do with some comments on the following.
I have the following erlang code that takes a list of tuples and returns a list minus an element if a key is found:
delete(Key, Database) ->
remove(Database, Key, []).
remove([], Key, Acc) ->
Acc;
remove([H...
I'm writing some Erlang code and I'm very unsure whether I should let everything fail fast. One problem I find with fail fast is that for the developer/user the exception generated is pretty meaningless. Any idea what I should return which would not give esoteric and hard to read stack traces?
...
I am using a single module a lot in the Erlang shell. Is there any shortcut that will enable me to omit the module: prefix when typing in commands?
...
When looking up messages in a sasl log using rb:list() or rb:show(), rb seems to dump the output in the console and return 'ok'; is there any way to configure rb to get it to return the actual log message ?
Thanks
...
I am developing a application for benchmarking purposes, for which I require to create large number of http connection in a short time, I created a program in java to test how much threads is java able to create, it turns out in my 2GB single core machine, the limit is variable between 5000 and 6000 with 1 GB of memory given to JVM after...
Hello,
startTrains() ->
TotalDist = 100,
Trains = [trainA,trainB ],
PID = spawn(fun() ->
train(1,length(Trains)) end),
[ PID ! {self(),TrainData,TotalDist} || TrainData <- Trains],
receive
{_From, Mesg} ->
error_logger:info_msg("~n Mesg ~p ~n",[Mesg])
after 10500 ->
refresh
end.
so, I created Two Processes nam...
I have a machine which doesn't give me local admin rights. Is it still possible to run erlang on it, as I cannot run a windows .exe installer to install erlang?
...
I have an erlang program which runs a server on a local machine and I would like it to start a local web browser and point to itself on startup. How can I do this in a portable way across Windows XP. Vista, and Windows 7?
...
Is there a stable Cassandra library for Erlang? I can't seem to find one
...
What protocol preferred to use for interaction between Python-code and Erlang-code over Internet? ASN.1 would be ideally for me, but its implementation in Python cannot generate encoder/decoder out from notation.
...
I have an Erlang app which makes a large number of http calls to external sites using inets, using the code below
case http:request(get, {Url, []}, [{autoredirect, false}], []) of
{ok, {{_, Code, _}, _, Body}}->
case Code of
200 ->
HandlerFn(Body);
_ ->
{error, io:format("~s returned HTTP ~p", [Broker, Code])...
I was reading a paper recently Why Events are Bad. The paper is a comparative study of Event based and thread based highly concurrent servers and finally concludes stating that Threads are better than events in that scenario.
I find that I am not able to classify what sort of concurrency model erlang exposes. Erlang provides Light Weigh...
Erlangs Characteristics
From Erlang Programming (2009):
Erlang concurrency is fast and scalable. Its processes are lightweight in that the Erlang virtual machine does not create an OS thread for every created process. They are created, scheduled, and handled in the VM, independent of underlying operating system. As a result, process...
I have looked everywhere, and to use Cassandra from Erlang you end up having to download (amongst others):
boost
thrift
: and then you have generate the erlang library by hand, and then copy lib files and beams files. Once you have the whole thing working there is absolutely zero documentation anywhere. If anyone could show me some use...
I am using Erlang to interface with Cassandra and I cannot get the get_slice command to return a list of all the columns of a row. I use:
X = thrift_client:call( C,
'get_slice',
[ "Keyspace1",
K,
#columnParent{column_family="KeyValue"},
#slicePredicate{},
1
...
It seems that these can only be generated on Unix and then copied over to Windows
...
Hi, I need replace the same value for variables {place} and {other_place} in the record op.
#op{
action = [walk, from, {place}, to, {other_place}],
preconds = [[at, {place}, me], [on, floor, me],
[other_place, {place}, {other_place}]],
add_list = [[at, {other_place}, me]],
del_list = [[at, {place}, me]...
i have the following ets structure:
SomeTable = ets:new(sometable, [bag]).
ets:insert(SomeTable, [
{set1,item1},
{set1,item2},
{set1,item3},
{set2,item1},
{set2,item2},
{set2,item4}]).
i want ...