Erlang/OTP Forums

Author Message

<  Erlang  ~  Noob Questions

ryanisinallofus
Posted: Thu Nov 19, 2009 11:06 pm Reply with quote
Joined: 19 Nov 2009 Posts: 2 Location: Seattle
Emacs seems to be the preferred editor - is that right?

Mac OSX seems to kind of suck for Erlang development. No binary (easy enough to compile), mac ports is always outdated, the macports version of emacs didn't come with the erlang-mode for some reason (not to mention the missing meta key). Is linux the preferred or (gasp!) windows?

I can't figure out what the pipe is for:

-module(lib_misc).
-export([sum1, sum/2]).

sum(L) -> sum(L, 0).

sum([], N) -> N;
sum([H|T]), N) -> sum(T, H+N).

I understand that H = head, T = Tail, but how is the tail used? And links to explain it? I'm at used to it at all.

Thanks in advance. I'm just reading through Programming Erlang right now.
View user's profile Send private message
Karalabe
Posted: Thu Nov 19, 2009 11:24 pm Reply with quote
User Joined: 03 Jul 2009 Posts: 11
The most straightforward development OS (for Erlang) I'd say is linux. And yes, people tend to prefer Emacs as it's easy to extend. Nonetheless I personally use Eclipse + ErlIDE, which in my opinion is a very powerful combination. It is still under heavy development, but it's completely stable and usable.

Pipes are used to separate the "tail" of the list from the few elements at the beginning (head). For example the list [1, 2, 3] could be also written [1, | [2, 3]] or [1, 2 | [3]] or even [1, 2, 3 | []]. Basically when you match a list, you can specify a couple of elements at the beginning (separated by commas), followed by all the rest (tail) separated from the head elements by a pipe. The tail will be a single list containing everything after the first few elements specified.
View user's profile Send private message
ryanisinallofus
Posted: Fri Nov 20, 2009 1:39 am Reply with quote
Joined: 19 Nov 2009 Posts: 2 Location: Seattle
I have grown tired of Apple and their OS. It's nice that most things *just-work* but I have been looking for an excuse to go back to Linux anyway.

As for the pipe explanation - THANKS. This did it for me right here:

"For example the list [1, 2, 3] could be also written [1, | [2, 3]] or [1, 2 | [3]] or even [1, 2, 3 | []]."
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum