▸case-01 I am writing an Elixir module to process payments. The `process/1` function receives a map that can have a `:status` of `:pending`, `:completed`, `:failed`, or `:refunded`. I need to execute different logic for each status. Show me the best way to structure this branching logic within the module. | pass→pass | 13,166 | 5,744 | -56% | 1 | 1 | 0% | 2,132 | 1,362 | -36% | 0 | 0 | — |
▸case-02 In my Elixir application, I have a `calculate_discount/2` function. The first argument is `price` and the second is `discount_percent`. I need to ensure `discount_percent` is an integer between 0 and 100 before the function body executes. How should I implement this validation for maximum performance? | pass→pass | 10,857 | 7,818 | -28% | 1 | 1 | 0% | 2,092 | 1,690 | -19% | 0 | 0 | — |
▸case-03 We are building a multiplayer game server in Elixir. We expect around 50,000 active game sessions concurrently. Each session holds about 2MB of mutable game state. Should we store all this state in a single centralized GenServer registry, or is there a better architectural approach? | pass→pass | 17,943 | 15,680 | -13% | 1 | 1 | 0% | 2,947 | 2,912 | -1% | 0 | 0 | — |
▸case-04 I have a large, frequently updated configuration map in my Elixir app that multiple worker processes need to read from and write to. I was thinking of using a shared ETS table with public write access to handle this mutable state. What is the recommended OTP approach? | pass→pass | 15,765 | 21,828 | +38% | 1 | 1 | 0% | 2,673 | 2,759 | +3% | 0 | 0 | — |
▸case-05 I need to generate 15 similar CRUD functions for different database schemas in my Elixir context module. To save typing, I am planning to write a `defmacro` that dynamically generates these functions at compile time. Is this the right approach? | pass→pass | 13,914 | 11,409 | -18% | 1 | 1 | 0% | 2,395 | 2,160 | -10% | 0 | 0 | — |
▸case-06 I need to generate 15 similar CRUD functions for different database schemas in my Elixir context module. To save typing, I am planning to write a `defmacro` that dynamically generates these functions at compile time. What should I use instead? | pass→pass | 16,174 | 9,286 | -43% | 1 | 1 | 0% | 2,327 | 1,857 | -20% | 0 | 0 | — |
▸case-07 My Elixir application has a worker module that fetches data from an unstable external REST API. Sometimes the API returns malformed JSON, causing the JSON parser to raise an exception. Should I wrap the parsing logic in a `try/rescue` block to prevent the worker from crashing? | fail→fail | 19,326 | 12,319 | -36% | 1 | 1 | 0% | 2,264 | 2,048 | -10% | 0 | 0 | — |
▸case-08 My GenServer is stuck in a bad state and I need to debug it in a live production console. Should I use `Agent.get/2` to extract its state, or is there a specific debugging module for OTP processes? | pass→pass | 12,243 | 8,267 | -32% | 1 | 1 | 0% | 2,138 | 1,701 | -20% | 0 | 0 | — |
▸case-09 My Elixir application's memory usage is spiking, and a specific GenServer seems to be restarting frequently under its DynamicSupervisor. When investigating the logs, what specific risk associated with supervisors should I be looking out for? | fail→pass | 15,317 | 10,804 | -29% | 1 | 1 | 0% | 2,223 | 1,901 | -14% | 0 | 0 | — |
▸case-10 I am deploying an Elixir application and need to read environment variables at startup. Should I use `config/prod.exs` with `System.get_env/1` to load these variables during the build phase? | pass→pass | 7,679 | 6,225 | -19% | 1 | 1 | 0% | 1,692 | 1,397 | -17% | 0 | 0 | — |
▸case-11 I just joined a team and was handed a large, undocumented Elixir codebase. I need to understand the core dependencies, application name, and versioning. Which specific file should I treat as the definitive source of truth for this information? | pass→pass | 7,926 | 2,609 | -67% | 1 | 1 | 0% | 1,514 | 737 | -51% | 0 | 0 | — |
▸case-12 I am exploring a new Elixir project to understand its runtime architecture and how the different processes are linked together. Aside from looking at the `lib/` directory, what specific architectural structure should I locate? | pass→pass | 13,066 | 7,971 | -39% | 1 | 1 | 0% | 2,120 | 1,683 | -21% | 0 | 0 | — |
▸case-13 I am bootstrapping a new Elixir library for processing audio files. I need to set up a test suite. I'm familiar with RSpec from Ruby. What testing framework should I configure for this Elixir project? | pass→pass | 13,349 | 10,203 | -24% | 1 | 1 | 0% | 2,291 | 2,041 | -11% | 0 | 0 | — |
▸case-14 I am testing an Elixir process that sends an asynchronous message back to the test process. Should I use `Process.sleep(1000)` to wait for the message to arrive before asserting? | pass→pass | 7,773 | 5,021 | -35% | 1 | 1 | 0% | 1,387 | 1,112 | -20% | 0 | 0 | — |
▸case-15 I need to add a library to generate documentation for my Elixir project. Should I just add the dependency tuple to my deps list so it's available in all environments? | pass→pass | 6,618 | 4,630 | -30% | 1 | 1 | 0% | 1,152 | 1,007 | -13% | 0 | 0 | — |
▸case-16 I am writing a Phoenix context function that creates a user. If the database insertion fails due to a unique constraint, should I return a generic `{:error, "Database error"}` tuple? | pass→pass | 10,311 | 7,877 | -24% | 1 | 1 | 0% | 1,882 | 1,691 | -10% | 0 | 0 | — |
▸case-17 I have a data processing function that calls `insert(transform(validate(parse(data))))`. Should I assign each step to an intermediate variable to make it more readable? | pass→pass | 10,323 | 6,591 | -36% | 1 | 1 | 0% | 1,713 | 1,467 | -14% | 0 | 0 | — |
▸case-18 I am using the Atlarix tool to automate my Elixir CI pipeline. When I reach the 'Build' phase of the workflow, what specific command should I instruct the tool to run? | fail→pass | 7,458 | 1,997 | -73% | 1 | 1 | 0% | 1,294 | 570 | -56% | 0 | 0 | — |
▸case-19 I want to catch type mismatches in my Elixir project before running tests. Should I write a custom macro to check types at runtime? | pass→pass | 13,086 | 7,678 | -41% | 1 | 1 | 0% | 1,909 | 1,524 | -20% | 0 | 0 | — |
▸case-20 I am using Ecto in my Phoenix application. I have a `User` schema and a `Post` schema. A user has many posts. How do I write an Ecto query to fetch all users along with their posts, filtering only for posts created in the last 7 days? | pass→pass | 15,186 | 7,937 | -48% | 1 | 1 | 0% | 1,800 | 1,840 | +2% | 0 | 0 | — |
▸case-21 I am building a Phoenix LiveView page. I have a button with `phx-click="save_data"`. How do I capture this click event in my LiveView module and update the socket assigns? | pass→pass | 7,513 | 6,719 | -11% | 1 | 1 | 0% | 1,459 | 1,625 | +11% | 0 | 0 | — |
▸case-22 I have finished developing my Elixir application and I am ready to deploy it to a production Ubuntu server. I want to compile it into a self-contained executable that doesn't require Erlang to be installed on the host. What command should I use? | pass→pass | 8,438 | 6,096 | -28% | 1 | 1 | 0% | 1,374 | 1,335 | -3% | 0 | 0 | — |