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 General Interest, Miscellaneous at 3:18 pm by stonecypher
Normally I’d do the rant myself, but io_error did a better job than I’m likely to do. This article contains the single funniest thing I’ve ever seen him say (the line about the governor; you’ll know it when you see it.)
Permalink
Trackback
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