shansiddiqui94

shansiddiqui94

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

Showing Posts 1 to 1

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]?

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
maennchen
:warning: Security advisory: Decimal DoS vulnerability A vulnerability has been published for decimal where very large exponents can cau...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
durvia
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes. We’re a small ...
New

Other Trending Topics Top

marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews