(( meatspace )) » erlang http://meat.net David Terrell's blog Tue, 08 May 2012 06:11:45 +0000 en hourly 1 http://wordpress.org/?v=3.3.2 OS/X 10.5.3, two workarounds http://meat.net/2008/05/osx-1053-two-workarounds/ http://meat.net/2008/05/osx-1053-two-workarounds/#comments Fri, 30 May 2008 15:11:14 +0000 David Terrell http://meat.net/2008/05/osx-1053-two-workarounds/ Continue reading ]]> OS/X 10.5.3 has google contacts sync, but 1) only if you’ve connected to an ipod touch or iphone, and 2) only when you sync an ipod. Lifehacker has a workaround.

Second, for whatever reason, this update causes erlang R12B2 to bus error at startup if you’ve enabled Hipe. Bummer. Workaround (courtesy of Geoff Cant): recompile from original source without hipe.

]]>
http://meat.net/2008/05/osx-1053-two-workarounds/feed/ 0
Erlang wish list http://meat.net/2007/08/erlang-wish-list/ http://meat.net/2007/08/erlang-wish-list/#comments Mon, 13 Aug 2007 21:05:35 +0000 David Terrell http://meat.net/2007/08/erlang-wish-list/ Continue reading ]]> WSGI. I don’t want an apache replacement, or at least have to bootstrap one just to write a webapp. I’d much rather have something very simple and callback based to handle requests and output dynamic data (and push static data through something else. No offense to erlang on that score but …)

]]>
http://meat.net/2007/08/erlang-wish-list/feed/ 3
for loops in erlang http://meat.net/2007/08/for-loops-in-erlang/ http://meat.net/2007/08/for-loops-in-erlang/#comments Sun, 05 Aug 2007 03:49:45 +0000 David Terrell http://meat.net/2007/08/for-loops-in-erlang/ Continue reading ]]> For loops in Erlang:

for(Max, Max, F) -gt; [F(Max)];
for(I, Max, F) -gt; [F(I)|for(I+1, Max, F)].

My I suggest instead either:

lists:each(lists:seq(Min, Max), F).

or:


for(I, Max, F) when I <= Max ->
  for_impl(I, Max, F, []).
for_impl(Max, Max, F, Acc) ->
  lists:reverse(Acc);
for_impl(I, Max, F, Acc) ->
  for_impl(I+1, Max, F, [F(I)|Acc].

The original version of this code will blow out the stack with non-trivial length loops.

]]>
http://meat.net/2007/08/for-loops-in-erlang/feed/ 2