Scol standard library package
0.3.1
Common and usefull functions for all Scol applications
|
Functions | |
std_lApplyFunc (list, f, x) | |
apply a function to a list More... | |
std_lCat (p, q) | |
Concat two list to one. More... | |
std_lDifference (lA, lB) | |
Difference between two lists. More... | |
std_lDifferenceSym (lA, lB) | |
Symetric difference between two lists (xor) More... | |
std_lDisjoint (lA, lB) | |
Returns if a list is disjoint in another one (they have no element in common). More... | |
std_lDivide (x, p, r1, r2, f) | |
Divide list. More... | |
std_lDivideList (item, items, sub1, sub2, func) | |
Divide a list in two sub lists. More... | |
std_lDivideString (x, p, r1, r2, f) | |
Divide string list. More... | |
std_lEltBigger (a, b) | |
Conivience function to compare two elements. More... | |
std_lEltCmp (a, b) | |
Conivience function to compare two elements (string excepted) More... | |
std_lEltNCmp (a, b) | |
Conivience function to compare two elements (string excepted) More... | |
std_lEltPos (list, e) | |
Return the position of an element. More... | |
std_lEltPosFunc (list, f, e) | |
Return the position of an element. More... | |
std_lEltPosStr (list, e) | |
Return the position of a string element case sensitive. More... | |
std_lEltPosStri (list, e) | |
Return the position of a string element case insensitive. More... | |
std_lEltSmaller (a, b) | |
Conivience function to compare two elements. More... | |
std_lEquals (lA, lB, f) | |
Return if two lists are equals (same size, same items, same order) More... | |
std_lExtractList (list, e, func) | |
Extract a list in two sub list. More... | |
std_lInclude (lA, lB) | |
Returns if a list is included in another one. More... | |
std_lIntersection (lA, lB) | |
Intersection between two lists (and) More... | |
std_lIsInList (list, e) | |
Check if a value is in a given list. More... | |
std_lIsInListFunc (list, f, e) | |
Check if a value is in a given list. More... | |
std_lQuickSort (list, func) | |
Sort a list using an external function. More... | |
std_lQuicksort (l, f) | |
std_lQuicksortString (l, f) | |
Sort a string list. More... | |
std_lRemoveElt (list, e) | |
Remove an element in a list. More... | |
std_lRemoveFunc (list, func, e) | |
Remove an element in a list by a function. More... | |
std_lRemoveStr (list, e) | |
Remove an string in a list. Case-sensitive. More... | |
std_lRemoveStri (list, e) | |
Remove an string in a list. Case-insensitive. More... | |
std_lReplaceElement (lSrc, oldElt, newElt) | |
Replace an element by other one. More... | |
std_lReplaceElementStr (lSrc, oldS, newS) | |
Replace an string by other one Case sensitive. More... | |
std_lReplaceElementStri (lSrc, oldS, newS) | |
Replace an string by other one Case insensitive. More... | |
std_lReverse (list) | |
Reverse a list (perform a mirror) More... | |
std_lSetUnique (lSrc) | |
Remove all supplemental elements. The list will have unique elements only. More... | |
std_lSetUniqueEx (lSrc, func) | |
Remove all supplemental elements. The list will have unique elements only. More... | |
std_lSortList (l, f) | |
Sort a list. More... | |
std_lSplit (l, pos) | |
Split a list in two list at given position. More... | |
std_lStriIsInList (list, e) | |
Check if a string is in a given string list case insensitive. More... | |
std_lStrIsInList (list, e) | |
Check if a string is in a given string list case sensitive. More... | |
std_lSub (list, start, end) | |
Extract a list between to indices. More... | |
std_lUnion (lA, lB) | |
Union between two lists (or) More... | |
Package to load : lib/std/list.pkg
std_lCat | ( | p | , |
q | |||
) |
Concat two list to one.
Prototype: fun [[u0 r1] [u0 r1]] [u0 r1]
[u0 | r1] : first list to concat |
[u0 | r1] : second list to concat |
std_lExtractList | ( | list | , |
e | , | ||
func | |||
) |
Extract a list in two sub list.
Prototype: fun [[u0 r1] u0 fun [u0 u0] I] [u0 r1]
[u0 | r1] : any list |
u0 | : the seperator (an element of the list) |
fun | [u0 u0] I : function to call to test |
std_lSortList | ( | l | , |
f | |||
) |
Sort a list.
Prototype: fun [[u0 r1] fun [u0 u0] I] [u0 r1]
[u0 | r1] : list to sort |
fun | [u0 u0] I : function to test |
std_lDivideList | ( | item | , |
items | , | ||
sub1 | , | ||
sub2 | , | ||
func | |||
) |
Divide a list in two sub lists.
Prototype: fun [u0 [u0 r1] [u0 r1] [u0 r1] fun [u0 u0] I] [u0 r1]
u0 | : could be the first element of a list |
[u0 | r1] : should be the next (tail) of a list |
[u0 | r1] : the first sub list (could be nil when this function is called) |
[u0 | r1] : the second sub list (could be nil when this function is called) |
fun | [u0 u0] I : a testing function to call with each element. It should return 0 if two elements are equals or a positive / negative integer depending on the order. |
std_lQuickSort | ( | list | , |
func | |||
) |
Sort a list using an external function.
Prototype: fun [[u0 r1] fun [u0 u0] I] [u0 r1]
[u0 | r1] : list to sort |
fun | [u0 u0] I : function for sort test |
std_lReverse | ( | list | ) |
Reverse a list (perform a mirror)
Prototype: fun [[u0 r1]] I
[u0 | r1] : list to revert |
std_lSub | ( | list | , |
start | , | ||
end | |||
) |
Extract a list between to indices.
Prototype: fun [[u0 rI] I I] [u0 r1]
[u0 | r1] : a list |
I | : the starting position. If nil, the list is fully returned. |
I | : the ending position. If nil, the list is fully returned. |
std_lSplit | ( | l | , |
pos | |||
) |
Split a list in two list at given position.
Prototype: fun [[u0 r1] I] [[u0 r1] [u0 r1]]
[u0 | r1] : list to split |
I | : position (start at 0), use a negative value for a position from the list end |
std_lDivide | ( | x | , |
p | , | ||
r1 | , | ||
r2 | , | ||
f | |||
) |
Divide list.
Prototype: fun [u0 [u0 r1] [u0 r1] [u0 r1] fun [u0 u0] I] [u0 r1]
Private
std_lDivideString | ( | x | , |
p | , | ||
r1 | , | ||
r2 | , | ||
f | |||
) |
Divide string list.
Prototype: fun [[S r1] [[S r1] r1] [[S r1] r1] [[S r1] r1] fun [[S r1] [S r1]] I] [[S r1] r1]
Private
std_lQuicksort | ( | l | , |
f | |||
) |
brief Sort a list
Prototype: fun [[u0 r1] fun [u0 u0] I] [u0 r1]
[u0 | r1] : list to sort |
fun | [u0 u0] I : function for sort test |
std_lQuicksortString | ( | l | , |
f | |||
) |
Sort a string list.
Prototype: fun [[S r1] fun [S S] I] [S r1]
[S | r1] : list to sort |
fun | [S S] I : function for sort test |
std_lApplyFunc | ( | list | , |
f | , | ||
x | |||
) |
apply a function to a list
Prototype: fun [[u0 r1] fun [u0 u1] u0 u1] [u0 r1]
[u0 | r1] : a list |
fun | [u0 u1] u0 : the function to call for each list element |
u1 | : a user parameter |
std_lRemoveFunc | ( | list | , |
func | , | ||
e | |||
) |
Remove an element in a list by a function.
Prototype: fun [[u0 r1] fun [u0 u0] I u0] [u0 r1]
[u0 | r1] : a list |
u0 | : the list element to remove |
std_lRemoveElt | ( | list | , |
e | |||
) |
Remove an element in a list.
Prototype: fun [[u0 r1] u0] [u0 r1]
[u0 | r1] : a list |
u0 | : the list element to remove |
std_lRemoveStr | ( | list | , |
e | |||
) |
Remove an string in a list. Case-sensitive.
Prototype: fun [[S r1] S] [S r1]
[S | r1] : a list |
S | : the list element to remove |
std_lRemoveStri | ( | list | , |
e | |||
) |
Remove an string in a list. Case-insensitive.
Prototype: fun [[S r1] S] [S r1]
[S | r1] : a list |
S | : the list element to remove |
std_lEltPos | ( | list | , |
e | |||
) |
Return the position of an element.
Prototype: fun [[u0 r1] u0] I
[u0 | r1] : a list |
u0 | : an element to found |
std_lEltPosStr | ( | list | , |
e | |||
) |
Return the position of a string element case sensitive.
Prototype: fun [[S r1] S] I
[S | r1] : a list |
S | : an element to found |
std_lEltPosStri | ( | list | , |
e | |||
) |
Return the position of a string element case insensitive.
Prototype: fun [[S r1] S] I
[S | r1] : a list |
S | : an element to found |
std_lEltPosFunc | ( | list | , |
f | , | ||
e | |||
) |
Return the position of an element.
Prototype: fun [[u0 r1] fun [u0 u0] I u0] I
[u0 | r1] : a list |
fun | [u0 u0] I : a function to compare, should return 1 if ok |
u0 | : an element to found |
std_lIsInList | ( | list | , |
e | |||
) |
Check if a value is in a given list.
Prototype: fun [[u0 r1] u0] I
[u0 | r1] : a list |
u0 | : an element to found |
std_lIsInListFunc | ( | list | , |
f | , | ||
e | |||
) |
Check if a value is in a given list.
Prototype: fun [[u0 r1] fun [u0 u0] I u0] I
[u0 | r1] : a list |
fun | [u0 u0] I : a function to compare, should return 1 if ok |
u0 | : an element to found |
std_lStrIsInList | ( | list | , |
e | |||
) |
Check if a string is in a given string list case sensitive.
Prototype: fun [[S r1] S] I
[S | r1] : a list |
S | : an element to found |
std_lStriIsInList | ( | list | , |
e | |||
) |
Check if a string is in a given string list case insensitive.
Prototype: fun [[S r1] S] I
[S | r1] : a list |
S | : an element to found |
std_lEltCmp | ( | a | , |
b | |||
) |
Conivience function to compare two elements (string excepted)
Prototype: fun [u0 u0] I
u0 | : an element |
u0 | : another element |
std_lEltNCmp | ( | a | , |
b | |||
) |
Conivience function to compare two elements (string excepted)
Prototype: fun [u0 u0] I
u0 | : an element |
u0 | : another element |
std_lEltSmaller | ( | a | , |
b | |||
) |
Conivience function to compare two elements.
Prototype: fun [u0 u0] I
u0 | : an element, generally an integer |
u0 | : another element, generally another integer |
std_lEltBigger | ( | a | , |
b | |||
) |
Conivience function to compare two elements.
Prototype: fun [u0 u0] I
u0 | : an element, generally an integer |
u0 | : another element, generally another integer |
std_lSetUnique | ( | lSrc | ) |
Remove all supplemental elements. The list will have unique elements only.
Prototype: fun [[u0 r1]] [u0 r1]
[u0 | r1] : a list |
std_lSetUniqueEx | ( | lSrc | , |
func | |||
) |
Remove all supplemental elements. The list will have unique elements only.
Prototype: fun [[u0 r1] fun [u0 u0] I] [u0 r1]
[u0 | r1]: a list |
fun | [u0 u0] I : function to test, at your convenience |
std_lReplaceElement | ( | lSrc | , |
oldElt | , | ||
newElt | |||
) |
Replace an element by other one.
Prototype: fun [[u0 r1] u0 u0] [u0 r1]
[u0 | r1] : a list |
u0 | : element to replace |
u0 | : new element |
std_lReplaceElementStr | ( | lSrc | , |
oldS | , | ||
newS | |||
) |
Replace an string by other one Case sensitive.
Prototype: fun [[S r1] S S] [S r1]
[S | r1] : a list |
S | : a string to replace |
S | : a new string |
std_lReplaceElementStri | ( | lSrc | , |
oldS | , | ||
newS | |||
) |
Replace an string by other one Case insensitive.
Prototype: fun [[S r1] S S] [S r1]
[S | r1] : a list |
S | : a string to replace |
S | : a new string |
std_lIntersection | ( | lA | , |
lB | |||
) |
Intersection between two lists (and)
Prototype: fun [[u0 r1] [u0 r1]] [u0 r1]
[u0 | r1] : a first list (ex : 0::2::4::6::nil) |
[u0 | r1] : a second list (ex : 0::3::6::nil) |
std_lUnion | ( | lA | , |
lB | |||
) |
Union between two lists (or)
Prototype: fun [[u0 r1] [u0 r1]] [u0 r1]
[u0 | r1] : a first list (ex : 0::2::4::6::nil) |
[u0 | r1] : a second list (ex : 0::3::6::nil) |
std_lDifference | ( | lA | , |
lB | |||
) |
Difference between two lists.
Prototype: fun [[u0 r1] [u0 r1]] [u0 r1]
[u0 | r1] : a first list (ex : 0::2::4::6::nil) |
[u0 | r1] : a second list (ex : 0::3::6::nil) |
std_lDifferenceSym | ( | lA | , |
lB | |||
) |
Symetric difference between two lists (xor)
Prototype: fun [[u0 r1] [u0 r1]] [u0 r1]
[u0 | r1] : a first list (ex : 0::2::4::6::nil) |
[u0 | r1] : a second list (ex : 0::3::6::nil) |
std_lInclude | ( | lA | , |
lB | |||
) |
Returns if a list is included in another one.
Prototype: fun [[u0 r1] [u0 r1]] I
[u0 | r1] : a list to check (ex : 2::4::nil) |
[u0 | r1] : another list (ex : 0::2::4::6::nil) |
std_lDisjoint | ( | lA | , |
lB | |||
) |
Returns if a list is disjoint in another one (they have no element in common).
Prototype: fun [[u0 r1] [u0 r1]] I
[u0 | r1] : a list to check (ex : 2::4::nil) |
[u0 | r1] : another list (ex : 0::2::4::6::nil) |
std_lEquals | ( | lA | , |
lB | , | ||
f | |||
) |
Return if two lists are equals (same size, same items, same order)
Prototype: fun [[u0 r1] [u0 r1] fun [u0 u0] I] I
[u0 | r1] : a first list |
[u0 | r1] : a second list |
fun | [u0 u0] I : a function to compare each first list item with each second list item. It must return 1 if two items are equals. |