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.
5
votes
2answers
124 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
25 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
49 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
15 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
49 views
1
vote
2answers
33 views
2
votes
1answer
48 views
2
votes
0answers
53 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 ...
5
votes
1answer
59 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
51 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
72 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
174 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
69 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
76 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
108 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
122 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
297 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
204 views
Multi-process FizzBuzz in Elixir
So I was playing with writing FizzBuzz in Elixir; this is my first, naive implementation:
...
3
votes
2answers
389 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?
...
4
votes
3answers
497 views
How does this naive stack implementation look?
Consider this naive stack implementation in Elixir:
...
4
votes
2answers
137 views
Fetching environment variables — can I use pattern matching?
I've got the following Elixir code:
...
6
votes
1answer
467 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
243 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.
...