X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.runtime%2Fscl%2FPrelude.scl;h=77e62c8582215cb6a4afcd3c4d65e26275bac0f1;hb=5317f37d8c47c3b2b206856a239a829e069bd750;hp=f2c24276510635390abee532e46f960547e381e9;hpb=3634fa43df6f9cfe65957cc2634eebc47856f0bd;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.runtime/scl/Prelude.scl b/bundles/org.simantics.scl.runtime/scl/Prelude.scl index f2c242765..77e62c858 100644 --- a/bundles/org.simantics.scl.runtime/scl/Prelude.scl +++ b/bundles/org.simantics.scl.runtime/scl/Prelude.scl @@ -1563,12 +1563,25 @@ printWithSeparator sb sep l = loop 0 (if i==0 then sb else sb << sep) <+ l!i loop (i+1) -"Joins the string representations of the list of values with the given separator." +""" +Joins the string representations of the list of values with the given separator. + +See [intercalate](#intercalate) for an alternative that works with Strings +and doesn't escape its arguments. +""" joinWithSeparator :: Show a => String -> [a] -> String joinWithSeparator separator values = runProc ( StringBuilder.toString $ printWithSeparator StringBuilder.new separator values) +""" +The intercalate function takes a String and a list of Strings +and concatenates the list after interspersing the first argument +between each element of the list. + +See also more generic [joinWithSeparator](#joinWithSeparator) +which escapes its arguments using `show`. +""" intercalate :: String -> [String] -> String intercalate separator strings = do l = length strings