When writing Prolog I use 4 components on my mac:
(1) SWI Prolog
(2) Visual Studio Code by Microsoft
(3) The VSC Prolog extension by Arthur Wang
(4) Some Prolog pack (installed with pack_install/1).
It takes a couple of steps to get this up and running. Is it somehow possible to automate the installation of these components, e.g. with a script or custom installer app? I am asking because i might want my students to use these components on their computers so easy installation would be useful (some have macs some have PCs). SWISH would be great but i have to rely on call/1 of arbitrary goals and this is blocked for understandable reasons.
Kind regards, JCR
Do all your students have Macs?
When I was a student in one of the lectures we got a ready-made virtual machine image with stuff installed on it. So we only had to install the VM client. VirtualBox for example seems to be available for Windows and for OS X, as well as the mainstream Linux distributions.
Aha, great idea, thanks. Some might have Windows. I’ll check out VirtualBox!
While Virtual Box will work on Windows and that was the solution I used many years ago, the more common way to do such on Windows currently for development is to use WSL 2.
If you like Visual Studio Code then a more advanced solution is to use a container, see: Developing inside a Container.
I also left many of my notes about this on this site at Wiki Discussion: Using WSL on Windows with SWI-Prolog
Thanks for the suggestions!
At least for the first step, swivm might come in handy. (Disclaimer: I’m its author.)
A word of warning about Macs and VirtualBox though – the new “M1” macs currently aren’t supported.
With macs there is always something that’s not supported
With regards to just Windows.
I have not tried this yet as I just learned of Windows Sandbox.
Windows Sandbox has the ability to use a configuration file and the configuration file has a logon command.
Since what you seek is so common among developers at the end of the configuration file page they even give an example that installs Visual Studio Code. As for persisting work once the Sandbox is ended, there are mapped folders.
If all of this makes you think of Docker, WSL or OCI then you are thinking the same as me.
If you try this, I would be interested in what you discover.
I plan to try this but put the configuration file and map the folders to a USB flash drive and just use different USB flash drives for different projects, think
plug, boot and play. Now if only I could get it so that plugging in a USB flash drive booted a sandbox and saved on unplugging it would be nice. I know, that is what cloud computing does, but I am cheap.
Out of curiosity I wondered if Mac OS had similar, I found App Sandbox. Since I don’t have a Mac I have no way of doing anything practical to learn about App Sandbox.
Thanks for the suggestion @EricGT! And all the useful links. I did not know about Windows Sandbox either. I will have a closer look and report back if i find any useful information!
I gave the example that uses VSCode a try with some changes to the location of the folders in the configuration file and while it did take about four minutes to get started, it did what I expected.
If you have any questions you want me to keep an eye out for while I learn more please ask either in this post or as a private message.
My goal now is to try and create what you seek, as I would also like the same, and if it works post it to a GitHub account for every one to use.
No rush on this, not even needed this week.
I am trying to create a process to install SWI-Prolog via a Windows command line using Curl or similar and was hoping to find a file under one of the sub-directories of
https://www.swi-prolog.org/download with a name containing
Is there somewhere that consistently and easily identifies the latest stable version and can be accessed via curl or something similar?
I.e., the comment below the download table says "Scripts can download the latest version by replacing the version of the file with
latest" This is answered by a redirect, so use curl -L` to get the file.
I found that and just tried as you were answering. Thanks.
C:\Users\WDAGUtilityAccount>curl -L https://www.swi-prolog.org/download/stable/bin/swipl-latest.x64.exe --output C:\Users\WDAGUtilityAccount\Downloads\swipl-latest.x64.exe
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 138 100 138 0 0 138 0 0:00:01 --:--:-- 0:00:01 245
100 11.2M 100 11.2M 0 0 5779k 0 0:00:02 0:00:02 --:--:-- 8406k
For those not understanding the details I will try and connect the dots.
The initial HTTPS request is for
swipl-latest.x64.exe on site
www.swi-prolog.org in directory
download/stable/bin which does not exist. The HTTPS response back is a 303 for
see other meaning try the other location given in the response, in this example
/download/devel/bin/swipl-8.3.22-1.x64.exe. So the next request just uses the new location and it all happens automatically.
The ideal solution would be to make SWI Prolog installable via a standard package manager on Mac or Windows.
On Mac you can add a formula to Homebrew.
Microsoft just came out with a package manager for Windows called winget very recently. You can contribute a winget manifest on GitHub easily.
There is a formula, but Homebrew doesn’t like extensive dependencies and the resulting system is a bit crippled There is a well maintained Macports port file. That works pretty well, but is (like the Homebrew version) compiled using Xcode which produces binaries for SWI-Prolog that have only about half the performance of the GCC compiled ones. The latter is used for the binary installers on the download page. We’ll see whether the work on the VM by @dmchurch reduces the gap between clang and gcc. As it, it seems GCC is much better at optimizing the giant main interpreter function than clang.