From 3634fa43df6f9cfe65957cc2634eebc47856f0bd Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Tue, 19 Sep 2017 09:35:22 +0300 Subject: [PATCH] Add undocumented functions in Prelude.scl to Prelude.md refs #7490 Change-Id: I4fef578b2880098755274f5078782db4d0dc0940 --- .../org.simantics.scl.runtime/scl/Prelude.md | 27 +++++++++++-------- .../org.simantics.scl.runtime/scl/Prelude.scl | 12 +++++++++ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/bundles/org.simantics.scl.runtime/scl/Prelude.md b/bundles/org.simantics.scl.runtime/scl/Prelude.md index f60a09b97..36b6023c9 100644 --- a/bundles/org.simantics.scl.runtime/scl/Prelude.md +++ b/bundles/org.simantics.scl.runtime/scl/Prelude.md @@ -7,8 +7,10 @@ ## Comparison -::class[Eq, Ord] +::class[Ord] +::value[!=] ::value[minimum, maximum, minimumBy, maximumBy, &<&] +::value[isDigit, isFinite, isInfinite, isNaN] ## Numeric functions @@ -19,7 +21,7 @@ ## Tuples -::value[fst, snd, curry, uncurry, curry3, uncurry3] +::value[fst, snd, curry, uncurry, curry3, uncurry3, swap] ## Maybe @@ -43,13 +45,16 @@ ::value[sort, sortBy, sortWith] ::value[index, indexBy, indexWith] ::value[unique, uniqueBy] -::value[tail, reverse, range, \\, deleteAllBy, for, lookup, addList] +::value[tail, reverse, range, \\, deleteAllBy, for, forI, lookup, addList] ::value[groupBy, intersect, findFirst] ::value[singletonList] ::value[group, groupWith] -::value[mapFirst, mapMaybe] +::value[mapFirst, mapMaybe, mapI] ::value[build] +::value[partition] ::value[uniqueWith] +::value[transpose] +::value[takeWhile] ## Strings @@ -57,9 +62,11 @@ ::value[contains] ::value[charAt] ::value[isLetter, addChar, subChar] +::value[intercalate] ::value[string] ::value[joinWithSeparator] ::value[printWithSeparator] +::value[split] # Higher order programming @@ -121,19 +128,13 @@ ## Other conversions -::value[toDoubleArray, fromDoubleArray, arrayToList] - -## Hashing - -::class[Hashable] -::value[hash] +::value[toDoubleArray, fromDoubleArray, arrayToList, listToArray] ## Serialization ::data[Builtin/Binding] ::class[Builtin/Serializable] ::value[Builtin/binding] -::value[serialize, deserialize] ## Typeable @@ -146,6 +147,10 @@ ::data[Dynamic] ::value[toDynamic, fromDynamic] +# Exception handling + +::value[catch] + # Undocumented entities ::undocumented[] \ No newline at end of file diff --git a/bundles/org.simantics.scl.runtime/scl/Prelude.scl b/bundles/org.simantics.scl.runtime/scl/Prelude.scl index 83d84ccf2..f2c242765 100644 --- a/bundles/org.simantics.scl.runtime/scl/Prelude.scl +++ b/bundles/org.simantics.scl.runtime/scl/Prelude.scl @@ -123,6 +123,7 @@ uncurry3 f (x, y, z) = f x y z flip :: (a -> b -> c) -> b -> a -> c flip f x y = f y x +"Swaps the order of elements of a pair (2-tuple)." swap :: (a,b) -> (b,a) swap (x,y) = (y,x) @@ -1417,6 +1418,17 @@ instance Read String where splitString :: String -> String -> [String] splitString source pattern = arrayToList $ splitString_ source pattern +""" +`split pattern text` splits `text` around matches of the given regular expression `pattern`. + +This function works as if by invoking the two-argument split method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting array. + +The string "boo:and:foo", for example, yields the following results with these expressions: + + Regex Result + : { "boo", "and", "foo" } + o { "b", "", ":and:f" } +""" split :: String -> String -> [String] split pattern text = arrayToList $ splitString_ text pattern -- 2.47.1