Mercurial > repos > other > SevenLanguagesInSevenWeeks
view 3-Prolog/day2-unification.pl @ 58:90c4b7f28690
Add initial Day 2 notes for Prolog
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 26 Sep 2017 20:58:49 +0100 |
parents | |
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