view 3-Prolog/day2-unification.pl @ 90:c27c87cd0f08

Add most of the Day 2 exercises for Haskell
author IBBoard <dev@ibboard.co.uk>
date Sun, 16 Jun 2019 21:09:33 +0100
parents 90c4b7f28690
children
line wrap: on
line source

% Unification works both sides of the equals:
% (A, 2, C) = (1, B, 3).
% We can't actually run this from a file, because Prolog. We get:
%
%     native code procedure (=)/2 cannot be redefined (ignored)
%
% But we can run it from the REPL.
%
% Lists have heads and tails:
%
% [a, b, c] = [Head|Tail].
%
% Underscore is the wildcard variable:
%
% [a, b, c] = [_|Tail].
%
% Note: It's not magic "Head|Tail", it's "[X|Y]" notation