You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You want to write portable code and to test it with multiple implementations. However installing them can be cumbersome and time consuming.
Solution
Running the code in a container using Docker.
Running a script
We mount the current working directory inside the container to /workdir and run file called test.scm. Replace the SCHEME_NAME with the name of the Scheme you want to use, for example "guile". And replace SCHEME_GOMMAND with command you want to run, for example "guile".
If you also need to install some packages inside the container it is better to create a Dockerfile and pass the implementation name as argument. Build it and then run container using the built image.
Here is and example of such Dockerfile in which Scheme implementation is passed as and argument. Then we install the packages we need, just curl here for example. Then we set the workdir inside the Dockerfile so we dont need to set it in the command.
ARG SCHEME=
FROM schemers/${SCHEME}
RUN apt-get update && apt-get install -y curl
WORKDIR /workdir
Then we build it using tag my-scheme and run it. Just like previously replace SCHEME_NAME and SCHEME_COMMAND with implementation and command you want.
Problem
You want to write portable code and to test it with multiple implementations. However installing them can be cumbersome and time consuming.
Solution
Running the code in a container using Docker.
Running a script
We mount the current working directory inside the container to /workdir and run file called test.scm. Replace the SCHEME_NAME with the name of the Scheme you want to use, for example "guile". And replace SCHEME_GOMMAND with command you want to run, for example "guile".
If you also need to install some packages inside the container it is better to create a Dockerfile and pass the implementation name as argument. Build it and then run container using the built image.
Here is and example of such Dockerfile in which Scheme implementation is passed as and argument. Then we install the packages we need, just curl here for example. Then we set the workdir inside the Dockerfile so we dont need to set it in the command.
Then we build it using tag my-scheme and run it. Just like previously replace SCHEME_NAME and SCHEME_COMMAND with implementation and command you want.
Opening a REPL
See https://containers.scheme.org/.
Notes
Credit: @Retropikzel
The text was updated successfully, but these errors were encountered: