Error Handling in Elixir Libraries

There was an interesting discussion yesterday on the Elixir Slack about how libraries should handle errors. This is a more thought-through and elaborate expression on my views on the matter. In the post, I’ll present an idealised version of how I think a public API for functions that may produce errors should look like.

»

Sudoku Solver in Prolog

Recently, at university, we had a class that introduced the idea of logic programming and explored a bit the Prolog language. I decided to play a bit more with it and write a Sudoku solver. Let’s see how it turned out.

»

Serving Encoded JSON With Poison

When building JSON APIs you often find yourself in a situation when you have part of the JSON already encoded and want to embed it in a bigger structure. A common solution is to decode the encoded part and embed the outer structure just to encode it back again. It’s obvious how that back-and-forth decoding and encoding is wasteful. Fortunately with poison we have a much better alternative.

»

If Considered Harmful - or Is It?

When Edsger Dijkstra wrote his famous letter “Go-to statement considered harmful” in 1968 the programming world was split between goto-supporters and goto-opponents. The first claimed goto simplifies programs and makes them faster, the others argued it makes programs hard to follow and understand. Today we live in a world where the goto-opponents clearly won. Almost all modern programming languages are devoid of goto, and those that have it, use it sparingly. Yet today, according to many, we face another monster - if. Some argue is as harmful as goto and should be avoided at all cost.

»

Understanding Lists

Lists are a basic data structure in functional languages, but they are also quite confusing for people accustomed to dealing with mutable arrays in imperative languages. The two things: arrays and lists are used in similar situations, they are however more different than it may seem. I’d like to address that explaining how lists work and implementing couple of functions form Enum module ourselves.

»