Wednesday, March 07, 2007
Learning Erlang
So like a lot of people I’m reading Joe Armstrong’s new beta book on Erlang.
- Still getting my head around variables that lockdown once assigned. I have to keep telling myself that with tail recursion, its not really leaving the function and recursing like I am used to with C, so the variable is still ‘live’ between calls. Mostly because I am unsure how X <= Pivot applies to strings and tuples. Strings just being lists of integers themselves should be ok, but tuples I don’t know about. I guess you would write a custom comparison function and map it in
- The quicksort example made me go “ooooh!” in understanding. As an exercise I want to try to make it work with a list of strings or a list of tuples and see how much more complex it gets
He also breaks into an example uses =:= without first explaining it.
I’m also don’t particularly like the
X /= Y X is not equal to Y X =:= Y X is identical to Y X =/= Y X is not equal to Y
I’m guessing the last is a typo and =/= is not identical as opposed to not equal.
I dont quite get the ‘identical’ parsings or what they might be used for. So far I’ve not found any explanation (it is a rough beta, so hopefully wil appear later). I also dislike the not-equal-to signage, I’m too ensconsed in thinking it needs to be != or <>.
I also think I am too used to say the ruby shell and what it lets you do. The Erlang shell seems overly simplistic. You cant build code snippets as you go. eg
cost(oranges)-> 5.will give an error you have to create an external module in a file and compile it. Which is fine but I feel defeats half the purpose of an interactive shell :(
I’m feeling Erlang a lot more than when I looked at Lisp. I dont think in s-expressions and reverse polish notation, to me that’s great to make easy parsing by interpreter but I dont think like that.
I’m dreaming of a multiplayer roguelike server in Erlang. Maybe once I am happy with my current roguelike I’ll think of doing a basic concept for a multiplayer roguelike. I’m not sure how Id map the data structures of the maps into Erlang, or what its C api interface is like for writing a module to generate the maps in C and passing them off to the server....
May be once I’ve gone through this book and chewed its concepts over I’ll have a better idea of data structures / data representation in erlang.
Filed Under : Development •
Commented on by (0) people. Read or Post Comments Here