HackerTrans
TopNewTrendsCommentsPastAskShowJobs

sysread

no profile record

comments

sysread
·2 年前·discuss
Non-interactive programs that emit informational output should only do so to stderr or a log file so that they may be used in a pipe line.
sysread
·2 年前·discuss
I tried this with elixir, and on my m3 mac, it ran in 6.5s. Perl took over 40s :P

  #!/usr/bin/env elixir
  u =
    case System.argv() do
      [arg] -> String.to_integer(arg)
      _ -> raise "Please provide a valid integer as the first argument."
    end

  r = :rand.uniform(10_000) - 1

  a = :array.new(10_000, default: 0)

  a =
    Enum.reduce(0..9_999, a, fn i, acc ->
      inner_sum =
        Enum.reduce(0..99_999, 0, fn j, sum ->
          sum + rem(j, u)
        end)

      updated_value = :array.get(i, acc) + inner_sum + r
      :array.set(i, updated_value, acc)
    end)

  IO.puts(:array.get(r, a))
sysread
·3 年前·discuss
Why does it request write access to my repos via gh auth?
sysread
·3 年前·discuss
[dead]