X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=stdlib%2Fprelude.gl;h=bfeb0ba21ff1f3fd71b594ccbdae73f7344df3e1;hb=c07380a3a4dca44a29df4cb09265d10442c1d06f;hp=fdb23e9ecd2f6e7b43820c34621bec4b24c0d914;hpb=a48b05d35f0646322e8178ff10f8ed7af3e739aa;p=goals.git diff --git a/stdlib/prelude.gl b/stdlib/prelude.gl index fdb23e9..bfeb0ba 100644 --- a/stdlib/prelude.gl +++ b/stdlib/prelude.gl @@ -40,21 +40,19 @@ tactic *exists (filename) = { #---------------------------------------------------------------------- # Text functions. - +# Sort + uniq a list. +function sort (xs) returning strings = { + for f in %xs; do echo "$f"; done | sort -u +} #---------------------------------------------------------------------- # File functions. # Expand a wildcard into a list of filenames. -function wildcard (wc) = { +function wildcard (wc) returning strings = { shopt -s nullglob # Note that the substitution is quoted by goals, so to expand # it we must assign it to a variable and then use it unquoted. wc=%wc - echo '[' - for f in $wc; do - quoted_string "$f" - echo ',' - done - echo ']' + for f in $wc; do echo "$f"; done }