Skip to main content
GameDev.net gamedev.net
🔒 Locked

Erlang

Started by smr Apr 12, 2007 at 10:33 PM 7 replies 1.8k views
Original Post
smr
smr
I've been searching for a functional language to add to my programming repertoire, but I'm not quite sure which one I should really focus on. I don't have a whole lot of free time to dedicate to my own research right now, so I was hoping you guys could help me out. I've looked at several languages, but I haven't really seemed to come across one single language that seems to be the one for me. I've dabbled in scheme and ocaml. I've read a bit about haskell, but it didn't really strike me as what I wanted to use. I've also come across erlang. Erlang seems pretty decent, if not an entirely pure functional language. I like the idea that distributed computing is a key feature of the language and runtime. The syntax doesn't seem too obtuse and makes good sense to me for the most part. I've went through the tutorials in an afternoon and they didn't lose me. I was wondering what your experiences with erlang have been and what I should watch out for while learning it. Are there any major warts about the language that someone considering the it should be aware of? Does it just plain suck? I'd like to know before I spend what little free time I have learning it. I think that having the ability think and program in a functional language is one of the cornerstones of being a good programmer. I use the functional features of python as frequently as I can, and many would argue that python is "as good as" a true functional language. That may or may not be true. I'm not qualified to judge. I just want to learn something new. Thanks in advance. EDIT: Oh, and if my post seems poorly written... yes, I've had a few drinks. My bad.
No Style
No Style
Erlang is a nice language, and its already proven to be viable for game programming needs:
http://lambda-the-ultimate.org/node/2102

The Mnesia DB-System is a further plus for erlang.
snk_kid
snk_kid
It's not clear as to exactly what you want, if you want to learn (properly) about the functional paradigm then i suggest haskell or SML with a good book on the topic of functional like Introduction Functional Programming using haskell by Richard Bird. Even if you they don't look interesting to you, this will force you to focus on the path of learning.

Many people think they know about functional programming when really they know very little about it except for the obvious, there is much more to it than what those people think it is. There is abit of an initial learning curve, it's not something your going to learn over a thew days off some online material so if you can't dedicate your time then well you know.

If you know about things like what recursive operators are and their useful properties, their generalizations etc, and understand some of the things shown in The Evolution of a Haskell Programmer then you or anyone could claim to know what the functional paradigm is about.
rollo
rollo
I agree with snk_kid, if your goal is learning functional programming, do it with SML instead. SML is very "pure" whereas Erlang is more pragmatic.

Erlag will also teach you good ways to handle concurrency which is nice of course.

Personally I very much prefer Erlang, and would argue that it is a much better fit for most projects.

What did you think about OCaml? I'v heard many good things (mainly from french exchange students), but never tried it myself.
smr
smr
I think I'll work with haskell. Thanks for your input. I'll pick up a copy of that book that you've recommended as well, snk_kid.
demonkoryu
demonkoryu
Quote:
Original post by rollo
What did you think about OCaml? I'v heard many good things (mainly from french exchange students), but never tried it myself.

From what I've read, people using OCaml professionally often come back to Haskell (see Linspire).

Apropos Haskell tutorial: A gentle introduction to Haskell seems very good.

snk_kid
snk_kid
I forgot to mention there is a second edition of that book, also Haskell: The Craft of Functional Programming 2nd edition is pretty good as well. Then there is ML for the working programmer 2nd edition on the SML front.
smr
smr
Perhaps I should start a new thread for this, but I'll try out my luck.

So I downloaded Visual Haskell and installed it. It works great. However, I'm following the Write Yourself a Scheme in 48 hours tutorial and cannot get the first example to compile:

(I added the line numbers for clarity)
1> module Main where2> import System.Environment3> 4> main :: IO ()5> main = do args <- getArgs6> 	putStrLn ("Hello, " ++ args !! 0)


Error:
Main.hs(5): The last statement in a 'do' construct must be an expression
smr
smr
I've figured it out. The lines under the do loop must be aligned:

module Main whereimport System.Environmentmain :: IO ()main = do args <- getArgs           putStrLn ("Hello, " ++ args !! 0)


If I would have been more patient and read a page or so beyond the example I would have figured it out. Oops! Lesson learned.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.