TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Elixir is for programmers

138 pointsby rohshallover 11 years ago

18 comments

rdtscover 11 years ago
I really like Elixir.<p>Not only does it have a clean, pleasant syntax, macros, but it has all the good parts from Erlang, namely:<p>* BEAM VM (isolated heaps, very well tuned scheduler, concurrent garbage collection)<p>* Pattern matching, once you&#x27;ve tried it, it is hard to go back.<p>* Ability to call Erlang code<p>BEAM VM is really a secret gem and many didn&#x27;t get a chance to play with it because they didn&#x27;t like Erlang&#x27;s syntax (personally, I do like Erlang&#x27;s syntax, but I think many don&#x27;t). Well there is little excuse now.<p>If you like DSLs and macros (yes, yes, I know it makes many people scared) this you can do neat stuff like these projects:<p><a href="https://github.com/elixir-lang/ecto" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;elixir-lang&#x2F;ecto</a> -- DSL to query databases
评论 #6864858 未加载
评论 #6866391 未加载
john2xover 11 years ago
Ever since I started getting into Clojure, I&#x27;ve been getting interested in these other functional programming languages. Lately I&#x27;ve been checking out Elixir. I don&#x27;t know what draws me to it (most likely the pretty website and logo :P, and partly because I hate the Java ecosystem). I want to get into it as well, but I just don&#x27;t see myself using it for anything? I mean for the types of problems I&#x27;m capable of solving, Clojure (and Python) seems to be sufficient. To me, it seems Erlang (and thus Elixir) only offers its advantages when building <i>really</i> large distributed systems. Is there any other use case for Erlang&#x2F;Elixir?<p>I&#x27;m still going to be reading up on Erlang&#x2F;Elixir for fun and to expand on how I approach problems, but right now I only associate Erlang with large distributed systems and I want to add other stuff to that association.
评论 #6865344 未加载
jweirover 11 years ago
Here is a write up about Elixir by Joe Armstrong (he had a little something to do with Erlang)<p><a href="http://joearms.github.io/2013/05/31/a-week-with-elixir.html" rel="nofollow">http:&#x2F;&#x2F;joearms.github.io&#x2F;2013&#x2F;05&#x2F;31&#x2F;a-week-with-elixir.html</a>
评论 #6865719 未加载
评论 #6864663 未加载
troutwineover 11 years ago
It&#x27;s interesting to see Elixir mentioned more and more. I don&#x27;t _quite_ see the use-case for it, but I&#x27;m so content with Erlang I&#x27;m almost surely not the audience the language targets. Will be fun to see if Elixir builds its own community or if Elixir folks slowly filter into the Erlang community as a whole.<p>- - -<p>EDIT<p>It occurs to me that the HN crowd might like Lisp Flavored Erlang: <a href="http://lfe.github.io/" rel="nofollow">http:&#x2F;&#x2F;lfe.github.io&#x2F;</a> It&#x27;s a lisp-2 written by Robert Virding, co-creator of Erlang, and is backed by a great group of folks.
评论 #6864664 未加载
评论 #6864581 未加载
Erwinover 11 years ago
If you liked the nice simple assert, you can get an imitation in Python tests using py.test: <a href="http://pytest.org/latest/assert.html" rel="nofollow">http:&#x2F;&#x2F;pytest.org&#x2F;latest&#x2F;assert.html</a><p>Source code:<p><pre><code> def test_function(): assert f() == 4 </code></pre> Output:<p><pre><code> def test_function(): &gt; assert f() == 4 E assert 3 == 4 E + where 3 = f() </code></pre> Here&#x27;s how it works: <a href="http://pytest.org/latest/assert.html#assert-details" rel="nofollow">http:&#x2F;&#x2F;pytest.org&#x2F;latest&#x2F;assert.html#assert-details</a> -- when importing the test module, all simple asserts are rewritten (which has some limitations if side effects are involved).<p>No more verbose self.assertTheItemIsInThisList(item, list) at least.
评论 #6868885 未加载
bitwalkerover 11 years ago
I recently started programming in Elixir. I chose to rewrite the customized Hubot instance I&#x27;m running at my company from the ground up in it - it&#x27;s been a great way to learn the language, and especially OTP.<p>OTP is really what makes Elixir (and Erlang for that matter) so impressive. Supervised, lightweight processes just seems so obvious as a solution to fault tolerance and concurrency - coming from C#, where doing multi-threaded programming is error-prone at best, Elixir&#x2F;OTP is a dream. I do miss the type system from C# or Scala, but type specifications help to mitigate the loss.<p>The one other feature that has been really pleasing to work with is pattern matching. Scala is the only other language I&#x27;ve used with some form of it, and after using Elixir&#x2F;Erlang&#x27;s pattern matching, Scala&#x27;s seems deficient in comparison. It&#x27;s an insanely powerful construct, I wish more languages had it.
pselbertover 11 years ago
A couple months ago I got into Project Euler and decided to tackle all of the problems with Elixir. It was a great way to learn syntax and performance nuances. Definitely a tool that I enjoy using and will be keeping up with.
thyrsusover 11 years ago
<p><pre><code> if(condition, do: a, else: b) </code></pre> looks like a function, but that implies Elixir does lazy evaluation so that only one of a or b gets evaluated. Or is something else going on?
评论 #6865942 未加载
adambardover 11 years ago
Edit: The below is actually wrong<p>&gt; For years I’ve wanted to be able to write my own control flow structures, such as an each...else that runs an else block if the each is empty (Handlebars templates have this).<p>Actually, python does have a (little-known) `for...else` structure that does what you want.<p><a href="http://psung.blogspot.ca/2007/12/for-else-in-python.html" rel="nofollow">http:&#x2F;&#x2F;psung.blogspot.ca&#x2F;2007&#x2F;12&#x2F;for-else-in-python.html</a>
评论 #6864666 未加载
thedudemabryover 11 years ago
Pot, meet kettle. Or whatever the positive version of that is. <a href="http://steve-yegge.blogspot.com/2006/04/lisp-is-not-acceptable-lisp.html" rel="nofollow">http:&#x2F;&#x2F;steve-yegge.blogspot.com&#x2F;2006&#x2F;04&#x2F;lisp-is-not-acceptab...</a>
mmlover 11 years ago
Someone should probably point out that it&#x27;s homoiconic too.
评论 #6865060 未加载
alanningover 11 years ago
I&#x27;m very interested in Elixir but I&#x27;m having trouble understanding the benefit of the &#x27;upcase&#x27; example at the end of the article. Compared to a single function with a conversion table, a function per character seems like a tremendous amount of overhead.<p>Is the purpose of implementing upcase this way to make it more easily parallelizeable in the map&#x2F;reduce sense?
评论 #6868097 未加载
eonilover 11 years ago
How Elixir offer type check - compile time parameter validity check on each specialized types - or similar feature?<p>Is this type inferencing language?
评论 #6865658 未加载
craigykover 11 years ago
Learning me some Elixir now and I like it. I wish anonymous functions didn&#x27;t have different call syntax though.
评论 #6867199 未加载
twicover 11 years ago
FWIW, Groovy also has those smart asserts. They&#x27;re nice. Not a big enough deal that i&#x27;d start a feature list with them, but nice.
评论 #6866784 未加载
coolsunglassesover 11 years ago
Too bad the lists aren&#x27;t counting lists and are dumb cons cells. :(<p>Has a cool Leiningen (clojure) inspired build&#x2F;dependency tool.
评论 #6864660 未加载
评论 #6864889 未加载
ternaryoperatorover 11 years ago
Wow, that center-aligned text is hard to read!
andylover 11 years ago
I tried to like Erlang, but the syntax turned me off.<p>Elixir was just what I needed. Makes the power of Erlang accessible. I like Elixir&#x27;s docs, tooling, and syntax, and look forward to seeing it progress.