1. Map a function or predicate in Mercury lang

    Mapping a function in Mercury lang is pretty simple. First you need a function:

    :- func myfunc(string) = string.
    myfunc(In) = Out :- 
      append(In, In, Out).

    Then you map it

    :- import_module list.
    NewList = map(myfunc, OldList)

    We can do the same thing with a predicate.

    :- pred mypred(string::in, string::out …
    read more
  2. How to convert a predicate from multi to det in Mercury lang?

    So you're learning Mercury lang and you have a predicate with multi determinism. Maybe it looks something like this:

    :- pred school(string:: in, string:: out) is multi.
    fish(Fish, ParticularFish) :-
      ( append("One ", Fish, ParticularFish)
      ; append("Two ", Fish, ParticularFish)
      ; append("Red ", Fish, ParticularFish)
      ; append("Blue ", Fish, ParticularFish)

    Which has four solutions …

    read more
  3. How to install Mercury lang?

    Installing Mercury can be an intimidating process. Here are the steps I followed to get Mercury lang up and running.

    1. Download the latest ROTD. This tutorial uses a ROTD dated 2018-04-30, you should replace this date throughout.

    2. Uncompress the source archive

      $ tar -xzf mercury-srcdist-rotd-2018-04-30.tar.gz
    3. Configure the installation to …

    read more
  4. Adding an XFCE4 terminal color scheme

    This may not be the 'correct' way of doing something, but you can place your xfce4 color scheme in the following folder:


    Look at the existing files for inspiration and add a [Scheme] and Name= line to the top.

    I successfully renamed terminalrc.jellybeans to …

    read more
  5. Define Error Cases Too

    When defining the interface between two sections of an application, don't forget to specify how errors are conveyed and how the receiving party can detect and handle them. Of course you should specify what errors might occur.

    Notes from my mistakes...

    (Note: Of course this sounds obvious, but I'll just …

    read more
  6. Unix Fortune on Mac and Custom Fortunes

    Install fortune on your mac with Homebrew.

    brew install fortune

    You can go ahead and start using it now, but if you want to customize your fortune files you need to know the following:

    Fortune files are found in /usr/local/share/games/fortunes.

    To add a new fortune file …

    read more
  7. « Page 2 / 4 »