summaryrefslogtreecommitdiff
path: root/prolog/smallest.pl
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/smallest.pl')
-rw-r--r--prolog/smallest.pl4
1 files changed, 4 insertions, 0 deletions
diff --git a/prolog/smallest.pl b/prolog/smallest.pl
new file mode 100644
index 0000000..1a8835b
--- /dev/null
+++ b/prolog/smallest.pl
@@ -0,0 +1,4 @@
+smallest([H], H).
+smallest([H|T], S) :-
+ smallest(T, E),
+ (H<E -> S is H; S is E).