From 3c093ea6370b1f07664ded6e8c6aad301a8e2cb5 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 10 Jan 2020 12:15:41 +0000 Subject: [PATCH] stdlib: Add wrap function. --- stdlib/prelude.gl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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. -- 1.8.3.1