From 50da8152f0cfceeea7c92d55c8bc2f75cecd98ef Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 4 Jan 2020 11:56:00 +0000 Subject: [PATCH] stdlib: Implement sort function. --- stdlib/prelude.gl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stdlib/prelude.gl b/stdlib/prelude.gl index 15b1c0b..7e6cbd5 100644 --- a/stdlib/prelude.gl +++ b/stdlib/prelude.gl @@ -37,6 +37,17 @@ tactic *exists (filename) = { test -f %filename || exit 99 } +#---------------------------------------------------------------------- +# Text functions. + +# Sort + uniq a list. +function sort (xs) = { + for f in %xs; do echo "$f"; done | sort -u +} + +#---------------------------------------------------------------------- +# File functions. + # Expand a wildcard into a list of filenames. function wildcard (wc) = { shopt -s nullglob -- 1.8.3.1