• 2 Posts
  • 11 Comments
Joined 1 year ago
cake
Cake day: July 10th, 2023

help-circle
  • flakpanzertoLinuxWhich hardware do you use and why?
    link
    fedilink
    arrow-up
    5
    arrow-down
    1
    ·
    1 year ago

    I have a System76 Lemur Pro 10, while the hardware quality is poor (poor speakers, poor quality chassis, poor trackpad), it has been pretty solid otherwise for the last 4 years, with PopOS as my daily driver which I really love.

    For work, I use a 2019 MacBook which has great hardware, but I am not a fan of MacOS. Will soon ask for upgrade to an M1. (My perfect laptop would be Apple hardware running PopOS).

    My next laptop will likely be a Framework laptop unless System76 rolls out their own hardware which is much much improved than their current lot. I hope my current laptop will probably last 2-3 more years, if not more. (btw I use Steam Deck for gaming needs)


  • Elixir solution

    To run it, you need Erlang and Elixir installed with iex available on path (installation instructions here)

    Paste the code in a file with extension .exs (e.g. solution.exs) and run with iex solution.exs.

    It prints the output to Standard Output and appends a newline at the end

    Please let me know if this method of running code does not work.

    defmodule Brackets do
      @pairs %{
        "]" => "[",
        "}" => "{",
        ")" => "("
      }
    
      def simplify(brackets) do
        brackets
        |> String.trim()
        |> String.graphemes()
        |> Enum.reduce([], &reducer/2)
        |> Enum.reverse()
      end
    
      defp reducer(c, []), do: [c]
    
      defp reducer(c, [x | rest] = acc) do
        if @pairs[c] == x do
          rest
        else
          [c | acc]
        end
      end
    
    end
    
    brackets = IO.gets("Please enter your input> ")
    
    brackets
    |> Brackets.simplify()
    |> IO.puts()