From: Richard W.M. Jones Date: Sat, 4 Jan 2020 11:56:00 +0000 (+0000) Subject: stdlib: Implement sort function. X-Git-Tag: v'0.2'~81 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=50da8152f0cfceeea7c92d55c8bc2f75cecd98ef;p=goals.git stdlib: Implement sort function. --- 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