Head links to SWISH notebooks, are they possible?

In following along on topic Six ways to iterate in Prolog I thought it would be nice to have a link in the first post to the SWISH page.

After some discussion with @joeblog and not being a SWISH aficionado I came to realize that a link to a SWISH notebook is not static, it changes with updates.

In looking for an answer I found SWISH: SWI-Prolog for Sharing which notes:

3.2 Source code and query management

As JSFiddle formed the initial inspiration for SWISH, SWISH has a facility to save the
program. The current version of SWISH explicitly targets the cooperative development
of Prolog programs and queries related to a dataset (see section 5.2). This triggered the
implementation of a more organised storage facility. The server-side storage module is
implemented in Prolog and inspired by GIT. Each file is versioned independently rather
than maintaining the version of a hierarchy of files. Files can be referenced by content
using their GIT compatible SHA1 hash or by name. The name can be considered a
version head and refers to the latest version with that name. The file save and load
interface provides the following operations:

– Saving a file anonymously, which produces a randomly generated URL similar to
JSFiddle.
– Saving a file by name.
– Saving a new version. The interface shows the available versions and the modifications.
– Forking a file under a new name. The history remains linked to the original.

Prolog source files can include other sources on the same server
using :- include(filename)., including the latest version or

:- include(hash). to include a specific version.

Noticing storage is GIT inspired, leads me to think that a link exist for the HEAD. If so how does one copy the link for the HEAD?

An example of where such a link would be placed.

Also a SWISH notebook

1 Like

The HEAD is just the name of the file. The store is git inspired, but does not have a notion of trees, which implies that every file has its own history and there is no connection between the histories of different files except for the time stamp. Alternatively, you can pick a specific hash and link to that. Nobody can modify that.

2 Likes