dojap
Any Elixir and/or Erlang wiz kid who could include this language in the primes "competition"
There is an interesting primes “competition” going on using docker containers here (it’s an introduction on how the test works and the first thematicaly similar languages Ada, Pascal and Delphi are tested and ranked):
The github page is here:
https://github.com/PlummersSoftwareLLC/Primes
The author said that new languages could be added.
Elixir and Erlang is currently missing.
I know Elixir/Erlang can’t win, but it would be nice if we could be included and get a nice result ![]()
Most Liked
al2o3cr
I wonder if precomputing the whole array of “primes up to 1,000,000” and putting it in a module attribute would count as “cheating” ![]()
defmodule VeryCheatingMuchFast do
@all_the_primes ComputePrimes.all(1_000_000)
def all_the_primes do
@all_the_primes
end
end
Sebb
Warning: I’m not a wiz kid.
The docker part ist easy and docker is also a handy tool to have in your toolbox.
Say you have a script prim.exs in the working directory
# calculate a prime number and print it out
IO.puts(1+1)
Check that you can run it with elixir prim.exs.
Then you can just run this script inside docker with
docker run -it --rm -v "$PWD":/prim -w /prim elixir:alpine elixir prim.exs
docker will automatically fetch the image “elixir:alpine” from elixir - Official Image | Docker Hub. -v and -w do some magic so that docker sees the host-filesystem. The last part just runs the script inside the container.
- install docker: Get Docker | Docker Docs
- docker+elixir: Running Elixir in Docker Containers
dojap
Wow, cdesch just added the solution for Elixir. Primes/PrimeElixir/solution_1 at drag-race · PlummersSoftwareLLC/Primes · GitHub
Last Post!
ityonemo
Popular in Discussions
Other popular topics
Chat & Discussions>Discussions
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security










