From: Richard W.M. Jones Date: Fri, 10 Jan 2020 12:15:41 +0000 (+0000) Subject: stdlib: Add wrap function. X-Git-Tag: v'0.2'~49 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=3c093ea6370b1f07664ded6e8c6aad301a8e2cb5;p=goals.git stdlib: Add wrap function. --- diff --git a/stdlib/prelude.gl b/stdlib/prelude.gl index f4ab20e..a73ef1a 100644 --- a/stdlib/prelude.gl +++ b/stdlib/prelude.gl @@ -38,6 +38,20 @@ tactic *exists (filename) = @{ } #---------------------------------------------------------------------- +# Basic functions. + +# Wrap list of strings in a call or tactic. +pure function wrap (wrapper, xs) = @{ + echo '[' + for x in %xs; do + echo %wrapper "( " + quoted_string "$x" + echo " )," + done + echo ']' +} + +#---------------------------------------------------------------------- # Text functions. # Sort + uniq a list.