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.
2
votes
0answers
25 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 ). :-
...
2
votes
1answer
39 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
166 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
27 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
55 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
19 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
77 views
1
vote
2answers
34 views
2
votes
1answer
51 views
2
votes
0answers
60 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
75 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
54 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
83 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
185 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
79 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
87 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
117 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
127 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
305 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
219 views
Multi-process FizzBuzz in Elixir
So I was playing with writing FizzBuzz in Elixir; this is my first, naive implementation:
...
3
votes
2answers
422 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
613 views
How Does This Naive Stack Implementation Look?
Consider this naive stack implementation in Elixir:
...
4
votes
2answers
140 views
Fetching environment variables — can I use pattern matching?
I've got the following Elixir code:
...
6
votes
1answer
523 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
261 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.
...