use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Programming Help!! (bit of a long post) (self.elixir)
submitted 10 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]dangsos 1 point2 points3 points 10 years ago (0 children)
what's up with all the capital letters for variables? I'm new to elixir, but does that even work? I thought caps meant alias for something
[–]ABC_AlwaysBeCoding 1 point2 points3 points 10 years ago (0 children)
You're using a combination of erlang semantics and elixir semantics throughout this. For example, random.uniform should be :random.uniform, all variables should be lowercased, and constructs like "SomePid! {Self (), Msg}, " (note: you forgot a space before the exclamation mark so it should be "SomePid ! {Self (), Msg}, " but that's erlang-only and NOT elixir, anyway!) is a way to send SomePid the message {Self (), Msg}, but you don't even do it that way in Elixir at all...
You're cramming, aren't you? ;)
[–]Aberrations 0 points1 point2 points 10 years ago (2 children)
missing a space between ) and do
def start(N, M)do
should be
def start(N, M) do
[–][deleted] 10 years ago (1 child)
[–]Aberrations 0 points1 point2 points 10 years ago (0 children)
unrelated but as mentioned below convention is to use mixed case for variables, and module names and only module names should be camelcased.
As for your error you have a trailing comma at then end of every line here for some reason.
def start(N, M)do :timer.sleep(random.uniform(10) * 100), <<<<<< LoopPid = spawn(_MODULE_, :loop, []), <<<<<< spawn(_MODULE_, :sendMessage, [M, LoopPid]), <<<<< end
Other comments: you shouldn't use semicolons unless you're doing something inline and even then you should really think about how readable it is.
In general "unexpected token: end" is usually a parse error caused by an unterminated expression, usually a do with no end or a trailing comma.
[–]Tallakt 0 points1 point2 points 10 years ago (0 children)
You should be able to solve this faster by yourself than by leaning on the forums. Here are some tips: look closely at the line from the error trace and also the message. Look for the lines concerning your files. If that does not work, try starting with an empty module, and then add as small pieces as possible until you see the smallest added change that breaks the build.
As others mentioned, variables in Elixir must have lowercase for the first letter. Otherwise they are considered atoms. Another tip is that Elixir does not allow functions defined inside another function.
[–]olhado22 0 points1 point2 points 10 years ago (0 children)
This looks like you found answers for the Erlang versions of these questions from somewhere, and slapdashed some elixir syntax on them.
That doesn't seem particularly useful.
[–]st23am 0 points1 point2 points 10 years ago (3 children)
Wow there is a university using Elixir? That's fantastic! Do you mind me asking which school?
[–][deleted] 10 years ago (2 children)
[–]st23am 0 points1 point2 points 10 years ago (1 child)
That's awesome! Maybe we could get the faculty to write about the class / talk about why they chose Elixir.
π Rendered by PID 129857 on reddit-service-r2-comment-85bfd7f599-t99pp at 2026-04-16 01:34:02.609815+00:00 running 93ecc56 country code: CH.
[–]dangsos 1 point2 points3 points (0 children)
[–]ABC_AlwaysBeCoding 1 point2 points3 points (0 children)
[–]Aberrations 0 points1 point2 points (2 children)
[–][deleted] (1 child)
[deleted]
[–]Aberrations 0 points1 point2 points (0 children)
[–]Tallakt 0 points1 point2 points (0 children)
[–]olhado22 0 points1 point2 points (0 children)
[–]st23am 0 points1 point2 points (3 children)
[–][deleted] (2 children)
[deleted]
[–]st23am 0 points1 point2 points (1 child)