Job Interview for Junior(erlang/elixir) developer experience

Hey Guys,

Offer Accepted: No

So I was contacted a few weeks ago about this position. The role was for a junior developer with experience in engineering. Who would be willing to learn Elixir or grow with existing knowledge. Essentially the client who is using Erlang wanted to move over to Elixir.

I gave the interview one week in advance before my flight to Turkey, I also advised the CTO of my flight and time away. The CTO gave me a take-home written in Elixir assignment the day before my flight.

The Take Home:
The take-home was a bit more of a challenge than I had expected it would be. I was required to build and design a CSV parser. Below are the requirements for the task

You will design and build a module/function that parses
a CSV file and applies a 2-arity Fun, record by record.

All your work should take place in a git repository.

Please take care to document/test your code.

The processing of the file should take care to not
consume excessive memory.

The parser should conform to RFC 4180 https://www.rfc-editor.org/rfc/rfc4180

The entry point should be a 4-arity function with parameters:
  a) File
  b) Fun (the fun to be applied to each valid row)
  c) Separator (default to comma)
  d) Maximum Error Count (default 0)

For simplicity sake:

  a) Treat the first row of the CSV as the header
  b) The Fun being passed should convert
     the received data into a map with keys being the
     values of the CSV header row and print them to stand out.

Error rows should be accumulated, should parsing
complete with less than the Maximum Error Count,
return the error rows with the reasons.

Please do not spend more than 2 hours on the task.

Personally I have never done anything like this before. I began to research and ask around how to attempt this. The reddit community told me that building a CSV parser without a framework is not recommended. So I attempted and didn’t get very far. My answers below

defmodule ParserProj22 do

  def entry_point(file, format_data, separator \\ ",", max_error_count \\ 0 ) do
    file
      |> Stream.file!

  end

  def format_data([headers | row] = data) do
    map = 
      headers
      |> Enum.zip(row)
      |> Enum.into(%{}) 
      
      IO.puts(map)
  end
end

# Map.new([{:b, 1}, {:a, 2}])

As you can see I didn’t get very far. How else could I have solved this problem?
Thank you for hearing me out, I understand the company wanted to see where I was at. However, I did advise them That I did not do Elixir professionally

Alright then, let’s start small. Given you have this string:

text = "111,222,333"

How would you transform that to [111, 222, 333]?

4 Likes