shansiddiqui94

shansiddiqui94

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

Most Liked

dimitarvp

dimitarvp

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

text = "111,222,333"

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

Where Next?

Popular in Discussions Top

New
AlexMcConnell
The reason that Rails is as popular as it is is because it’s very easy for relatively inexperienced developers to get a lot of work done....
588 20142 166
New
rower687
Hi all, I’ve been reading a lot about the “let it crash” term and how supervising processes and the whole messaging passing make an elixi...
New
New
AstonJ
Can you believe the first professionally published Elixir book was published just 8 years ago? Since then I think we’ve seen more books f...
New
matthias_toepp
I’d love to hear what people think about Wisp, the new Gleam web framework started by Gleam’s primary creator Louis Pilfold. Gleam, alon...
New
arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement