I'm think I see more and more coders looking into Erlang and Lisp. Since I learned
it in exactly the same order, and now, I'm looking into Forth, does it mean that Forth is the next language on everyone's TODO list?
What is your next language?
...
[This will only make sense if you've seen Kevin Smith's 'Erlang in Practice' screencasts]
I'm an Erlang noob trying to build a simple Erlang/OTP system with embedded webserver [mochiweb].
I've walked through the EIP screencasts, and I've toyed with simple mochiweb examples created using the new_mochiweb.erl script.
I'm trying to fig...
I am doing Comet chat with Erlang and PHP. But now I think I met a problem: the polling connection will disconnect and reconnect automatically in about a certain time (I set this with 10 seconds), so there will be a period of time that the user doesn't connect to chat server. If a user send message at that time, the message will be dead...
I am using mochiweb and I don't know how to use its json encoder to deal with complex data structure. What's the differences between mochijson and mochijson2? Is there any good example? I always get the following errors:
46> T6={struct,[{hello,"asdf"},{from,"1"},{to,{a,"aa"}}]}.
{struct,[{hello,"asdf"},{from,"1"},{to,{a,"aa"}}]}
47> moc...
I'm writing an Erlang function which prints every even number up to a given parameter.
So far, I've written the function with guards like this:
printEven(I,N) when I < N ->
if
I rem 2 == 0 -> io:format("~p~n",[I]), printEven(I+1,N);
I rem 2 == 1 -> printEven(I+1,N)
end;
printEven(I,N) ->
io:format("Done").
I'd really l...
The book I'm reading about Erlang has exercises in the back of it and one is to re-create the lists:append function.
I could do this simply using the ++ operator, but isn't this really slow? And I think the point of the exercise is to do it using list operations that I write.
So far the only approach that I could think of is to do some...
As far as I know there's Erlang plugin for NetBeans and Eclipse. Which one has the upper hand at the moment?
Are there any other IDE for Erlang which I didnt mention, and how good are they when compare with NetBeans and Eclipse?
...
Does Erlang work on any non-x86 platforms?
Microcontrollers for instance? I think it'd be neat to get a bunch of these and put Erlang code on them.
Or does it work on GPUs? With Erlangs concurrent nature, it should be able to properly use a GPU. Or is CUDA pretty much it (at least for NVidia cards)?
...
Erlang fault tolerance (as I understand it) includes the use of supervisor processes to keep an eye on worker processes, so if a worker dies the supervisor can start up a new one.
How does Erlang do this monitoring, especially in a distributed scenario? How can it be sure the process has really died? Does it do heart beats? Is someth...
Hi.
I have a mnesia table for this record.
-record(peer, {
peer_key, %% key is the tuple {FileId, PeerId}
last_seen,
last_event,
uploaded = 0,
downloaded = 0,
left = 0,
ip_port,
key
}).
Peer_key is a tuple {FileId, ClientId}, now I need to extract the ip_port field from all peers that have a specific...
How can I write map-reduce functions in Erlang for CouchDB? I am sure Erlang is faster than JavaScript.
...
Hi.
I have a running erlang application, launched with this command line
erl -boot start_sasl -config config/cfg_qa -detached -name peasy -cookie peasy -pa ./ebin -pa ./ebin/mochiweb -s peasy start
If I start a new node and run appmon:start(), the 'peasy' node won't show up, even if using the same cookie. The same happens with webtoo...
In Erlang is there a way reference the currently executing function)?
That would be useful to spawn an infinite loop:
spawn(fun() -> do_something, this_fun() end)
In JavaScript arguments.callee does just that, see the specification on MDC.
Edit to answer a 'why would you do that': mostly curiosity; it is also useful to define a time...
If I have multiple web server written in Erlang running (load balanced) and Mnesia is used for the backend database, what is the best way to upgrade the whole system to a newer version?
...
When I start up my Erlang emulator, there the first bit has a bunch of informational things. (Slightly reformatted for effect.)
manoa:~ stu$ erl
Erlang (BEAM) emulator version 5.6.5
[source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.6.5 (abort with ^G)
1>
Some of it I can guess at, probably accurate, but some...
Is there a fast way to convert a flat list into a list of two-tuples such that a flat list like [1,2,3,4,5,6] becomes [{1,2},{3,4},{5,6}]?
This works, but it feels just plain WRONG:
tuples_from_flat_list(Target) ->
TargetWithIndex = lists:zip(lists:seq(1, length(Target)), Target),
{K, V} = lists:partition(fun({I, _}) -> I rem 2...
Is there an equivalent to this SQL statement in Mnesia?
alter table TABLE
add foreign key (FIELD)
references TABLE2 (FIELD2)
...
Hi.
I'm writing a bittorrent tracker in erlang. Given the nature of the service,
I won't need absolute consistency (ie. a client can be perfectly happy with a slightly outdated list of peers or torrent status).
My strategy so far has been to create mnesia tables in RAM with disc_copies enabled, so to have mnesia automatically dump the ...
Hi.
When writing code in Java, it is very helpful to embrace composition and dependency injection to make it possible and easy to do pure unit testing by mocking collaborating objects.
I find that doing the same in Erlang is less straightforward and makes for dirtier code.
That's likely to be my fault, as I'm quite new to Erlang and q...
I'm quite new to that functional programming paradigm, but so far I like it. Since I'm into game development, I want to try it out in writing some games in purely functional programming style. I don't mind the language - be it Erlang, Haskell, Lisp, or even Ruby (I found out it supports functional programming traits).
Well, it is obviou...