Elixir is a functional meta-programming aware language built on top of the Erlang VM. It is a dynamic language with flexible syntax with macros support that leverages Erlang's abilities to build concurrent, distributed, fault-tolerant applications with hot code upgrades.
-1
votes
1answer
51 views
Patten matching to check for non-empty argument list
I'm learning Elixir.
while building a trivial cli application (as seen here http://asquera.de/blog/2015-04-10/writing-a-commandline-app-in-elixir/) I'm defining a module that implements a ...
4
votes
1answer
77 views
Codewars kata : reverse and rotate
I just started to learn Elixir and to train on Codewars.
I solved this kata but I'm not very satisfied of my code and I have no clue (literally) how to improve it.
Recursion seems the way to go here, ...
2
votes
1answer
47 views
Scoring Ping Pong in Elixir
I have some elixir code I am using to score a ping pong game. Since I am new to functional programming I was hoping there might be a more elegant solution to this.
This part of the code is used in a ...
2
votes
0answers
66 views
Hex to Binary Conversion
Just mucking around with Elixir and bitstrings and wondering if there is a better way to implement the following ( or improve ). :-
...
3
votes
1answer
49 views
Elixir / Phoenix login controller, allowing multiple attempts
I have a login method in my controller. I would like to get rid of the imperative "thinking" and write something more functional.
...
5
votes
2answers
193 views
Pattern matching deeply nested arguments in Elixir
I've recently started working with Elixir and am writing an app that queries various URLs and parses the response. I am having issues with my parse method, which is ...
0
votes
0answers
33 views
Read a file into a list tail-first
This is some code which I created to read a file into a list tail first. In this case, I need to search for something in the file from the end first so this works out perfectly for what I need.
<...
4
votes
1answer
89 views
Count words in string and tally up the repetitive words
I'm an elixir beginner. I'm doing the word count exercise of exercism website. The word count exercise returns a map with the word as the key and the number of instances as value. The exercise ...
1
vote
0answers
27 views
Phoenix/Ecto: Update associated fields
I have this model
schema "jobs" do
field :name, :string
has_many :shiptos, MosaicApi.ShipTo
end
I want to update the shiptos associated with a job: ...
2
votes
1answer
132 views
1
vote
2answers
34 views
2
votes
1answer
66 views
2
votes
0answers
67 views
Converting Chess FEN Notation to a Tuple and Back
This module is going to be part of a larger ElixirChess library for validating chess positions and moves, but I started with the core of it which is parsing a ...
6
votes
1answer
89 views
Chat room using GenServer
It seems odd that state must be passed around all the time. Can't State module hold itself, so I could do something like
...
2
votes
0answers
65 views
Coloring trees in Elixir
The following is my tree coloring realisation attempted to get a feel of Elixir (simple, but slow coloring algorithm from Principles of Distributed Computing). Coloring runs from the root, using ...
3
votes
1answer
108 views
Return a grouped sum from a list
I just started with Elixir and this is what I have now. Is there an easier or better way to write this?
...
3
votes
1answer
200 views
Simple/Naive Implementation of Identity and Maybe Monad in Elixir
This is my first crack at a identity monad and a maybe monad in Elixir:
...
3
votes
0answers
91 views
Phoenix Ecto schema for internal mailbox
I am building an application messaging system. I am planning on using channels for real-time notifications but I was wondering if this schema makes sense. I am looking for any constructive criticism ...
2
votes
0answers
114 views
Ascii85 in Elixir
I'm a complete newbie to Elixir, but I managed to bang together this working example of Ascii85 for a project I'm working on in my spare time.
I find some awkward repetition in here which I have ...
4
votes
1answer
140 views
Generating all valid dates
I've come up with the following code to generate a list of all dates between two given dates:
...
3
votes
0answers
137 views
War Game GenServer Implementation
One of the Etudes for Elixir exercises is to create a War game that uses the spawn, send, and ...
1
vote
0answers
84 views
6
votes
2answers
323 views
Berlin clock kata in Elixir
I'm starting with Elixir and as exercise I wrote the Berlin Clock kata:
The clock is made up of 5 rows.
On the very top of the clock is a lamp that blinks to show the seconds. It turns on for one ...
11
votes
1answer
237 views
Multi-process FizzBuzz in Elixir
So I was playing with writing FizzBuzz in Elixir; this is my first, naive implementation:
...
4
votes
2answers
460 views
How could this be written using continuation passing style?
Is there a way to use CPS in this code to make the two insert functions tail-call optimized?
...
5
votes
3answers
714 views
How Does This Naive Stack Implementation Look?
Consider this naive stack implementation in Elixir:
...
4
votes
2answers
148 views
Fetching environment variables — can I use pattern matching?
I've got the following Elixir code:
...
6
votes
1answer
565 views
Elixir pipes and anonymous functions
I recently got started with Elixir. I'm used to F#'s pipes, and Seq.map and LINQ's .Select statements. Things are different in ...
10
votes
1answer
283 views
Roman numeral kata in Elixir
I'm new to Elixir, and in order to learn the syntax, I'm doing a roman numeral kata which converts a decimal number into roman numeral. I would appreciate any feedback you have.
...