Settings

Theme

Pros of Conses – Lesson learned about lists in Erlang

vid.bina.me

8 points by vidbina 10 years ago · 4 comments

Reader

zzalpha 10 years ago

It's worth noting this is far from unique to Erlang. Any language that models lists this way (Haskell and Lisp immediately spring to mind, but there's plenty of others) share this property.

  • fenollp 10 years ago

    What do you mean "lists this way"?

    A list is always a linked list, simply of doubly, and that's the name that defines the datastructure. If you want an other complexity for such-and-such operation use another datasctructure. Be it stack, array / vector, tree, trie, …

    Lists are lists in C++, Erlang, Haskell, Obj-C, … If one calls a PHP `array()` or a JS `[]` a list, it's not right in the CS sense, but it's correct in the general sense I guess.

    But then again, this is something one learns with time.

  • vidbinaOP 10 years ago

    Absolutely! I've just started looking into functional languages and am discovering a world of patterns that are ubiquitous within the paradigm. I have only experienced conses in Erlang so far (and in Haskell even though I had no idea that they were called that way). Just looked it up on wiki, so thanks for pointing it out (https://en.wikipedia.org/wiki/Cons).

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection