Map a 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)
more ...

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 …

more ...

Print a list of strings in Mercury lang

Here's a quick gist for printing a list of strings out in Mercury lang. I found that I needed this when learning the language. Maybe you do too.

Is there a better way to do this? Of course there is, I just haven't learned it yet. For example there is …

more ...

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 …

more ...

A response to "A short critique of Stallmanism"

As always, I am writing these entries in order to solidify and formulate my opinions. I may end up reversing opinions of what I write. I hope that by writing this out I may have a better understanding then the general mutterings which pass through my brain on occasion. Let …

more ...

Modern Mayan Temples

Aboard a bus departing the Cancun airport I notice a small stepped-pyramid adjacent to the on-ramp of the high-way. It stands the height of a single story, too close to the roadway to have been constructed afterwards, but oddly prominent. Is this pyramid a lesser, forgotten Tulum or Chitzen Itza …

more ...

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:

/usr/share/xfce4/terminal/colorschemes

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

I successfully renamed terminalrc.jellybeans to …

more ...

Keep this in Mind

Here is a list of things to keep in mind for the next time you use an ATM.

  • In July 2016, State Street Bank reached a $382 million settlement with DOJ for rigging foreign currency exchanges.

  • In June 2014, the French bank BNP Paribas was ordered to pay $8.9 …

more ...

Star Charts, a first round review

This summer I deployed star charts in hopes of gaining skills and acquiring better habits. The star charts started on the 13th of July and ended whenever I realized they were no longer working. In this post I will try to identify why.

This qualitative review of my progress will …

more ...

Geolocating

Finding the location of photos and paintings of real places around the world.

more ...