05.28.08
Posted in Erlang, General Interest, Miscellaneous, Tools and Libraries, Tutorials at 7:15 pm by stonecypher
I had to write these for a colleague some months ago, and promptly forgot in classic fashion. Here’s something to mock my inability to write coherent install docs for posterity: Setting Up eJabberD From Scratch. A how to, of sorts, I guess. This was written for a Centos server, but is probably accurate for most Unices (don’t really know for sure.)
Permalink
Trackback
Posted in Erlang, Miscellaneous at 5:49 pm by stonecypher
I just realized I never posted my Erlang highlighter for ConTEXT. ConTEXT is a free Windows programmer’s editor, and I’ve used it and MSVS basically exclusively for many years now.
Here’s my Erlang highlighter: http://sc.tri-bit.com/outgoing/Erlang.chl
Permalink
Trackback
02.23.08
Posted in Erlang at 3:58 pm by stonecypher
So I’m working on a quick run at 99 Lisp Problems in Erlang, because I’m a little bored of Project Euler, and I write myself a tiny little testing rig.
run_all_tests() ->
TestList = lists:seq(1, ?LastQuestion),
TestResults = [ { TestNum, apply( ?MODULE, list_to_atom("t" ++ integer_to_list(TestNum)), [] ) } || TestNum <- TestList ],
{ Pass, Fail } = lists:partition( fun({_,TestStatus}) -> TestStatus end, TestResults ),
{ { pass, [ P || {P,_} <- Pass ] },
{ fail, [ F || {F,_} <- Fail ] } }.
And it occurs to me: if I had the ability to slap a name on that fun - say, strip_tuple - then its purpose would be far more obvious, and the whole block of code would suddenly be much easier to read. I realize that the purpose of lambdas is to just write out as functions what couldn’t easily be expressed otherwise and yet stay inline, which has enormous space-savings, readability and debugging benefits. But, there’s nothing in there that actually requires my inability to paste a label on it, is there?
Why can’t I name a lambda?
Permalink
Trackback
02.11.07
Posted in Erlang at 6:05 pm by stonecypher
… which screws you nicely for a while, while you’re trying to figure out what’s broken in your erlang port. Unfortunately, there doesn’t seem to be a portable solution. That said, here’s what you do in unix:
freopen(NULL, “wb”, stdin);
freopen(NULL, “wb”, stdout);
And, in Windows:
_setmode( _fileno( stdin ) , _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
That should save you some pain.
Permalink
Trackback
02.01.07
Posted in Erlang, Programming, Tutorials at 12:21 am by stonecypher
I’m becoming ever more convinced that the answer is yes. I’ve been playing, a bit, a game called Project Euler, a game for programmers wherein the object is to find solutions to deceptively simple problems. It’s surprisingly entertaining, and your score is a result of the function of programmers which have not succeeded in a task.
There are people who take long roundabout approaches to get to results like these, when instead they could be doing things like
p1() -> lists:sum(
[ X || X <- lists:seq(1,10),
((X rem 3) == 0) orelse ((X rem 5) == 0) ]
).
As a result, I’m starting to think that I need to start explaining things. Anyone agree or disagree?
Permalink
Trackback