![]() |
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 | |
| std_lCat (p, q) | |
| Concat two list to one. | |
| std_lDifference (lA, lB) | |
| Difference between two lists. | |
| std_lDifferenceSym (lA, lB) | |
| Symetric difference between two lists (xor) | |
| std_lDisjoint (lA, lB) | |
| Returns if a list is disjoint in another one (they have no element in common). | |
| std_lDivide (x, p, r1, r2, f) | |
| Divide list. | |
| std_lDivideList (item, items, sub1, sub2, func) | |
| Divide a list in two sub lists. | |
| std_lDivideString (x, p, r1, r2, f) | |
| Divide string list. | |
| std_lEltBigger (a, b) | |
| Conivience function to compare two elements. | |
| std_lEltCmp (a, b) | |
| Conivience function to compare two elements (string excepted) | |
| std_lEltNCmp (a, b) | |
| Conivience function to compare two elements (string excepted) | |
| std_lEltPos (list, e) | |
| Return the position of an element. | |
| std_lEltPosFunc (list, f, e) | |
| Return the position of an element. | |
| std_lEltPosStr (list, e) | |
| Return the position of a string element case sensitive. | |
| std_lEltPosStri (list, e) | |
| Return the position of a string element case insensitive. | |
| std_lEltSmaller (a, b) | |
| Conivience function to compare two elements. | |
| std_lEquals (lA, lB, f) | |
| Return if two lists are equals (same size, same items, same order) | |
| std_lExtractList (list, e, func) | |
| Extract a list in two sub list. | |
| std_lInclude (lA, lB) | |
| Returns if a list is included in another one. | |
| std_lIntersection (lA, lB) | |
| Intersection between two lists (and) | |
| std_lIsInList (list, e) | |
| Check if a value is in a given list. | |
| std_lIsInListFunc (list, f, e) | |
| Check if a value is in a given list. | |
| std_lQuickSort (list, func) | |
| Sort a list using an external function. | |
| std_lQuicksort (l, f) | |
| std_lQuicksortString (l, f) | |
| Sort a string list. | |
| std_lRemoveElt (list, e) | |
| Remove an element in a list. | |
| std_lRemoveFunc (list, func, e) | |
| Remove an element in a list by a function. | |
| std_lRemoveStr (list, e) | |
| Remove an string in a list. Case-sensitive. | |
| std_lRemoveStri (list, e) | |
| Remove an string in a list. Case-insensitive. | |
| std_lReplaceElement (lSrc, oldElt, newElt) | |
| Replace an element by other one. | |
| std_lReplaceElementStr (lSrc, oldS, newS) | |
| Replace an string by other one Case sensitive. | |
| std_lReplaceElementStri (lSrc, oldS, newS) | |
| Replace an string by other one Case insensitive. | |
| std_lReverse (list) | |
| Reverse a list (perform a mirror) | |
| std_lSetUnique (lSrc) | |
| Remove all supplemental elements. The list will have unique elements only. | |
| std_lSetUniqueEx (lSrc, func) | |
| Remove all supplemental elements. The list will have unique elements only. | |
| std_lSortList (l, f) | |
| Sort a list. | |
| std_lSplit (l, pos) | |
| Split a list in two list at given position. | |
| std_lStriIsInList (list, e) | |
| Check if a string is in a given string list case insensitive. | |
| std_lStrIsInList (list, e) | |
| Check if a string is in a given string list case sensitive. | |
| std_lSub (list, start, end) | |
| Extract a list between to indices. | |
| std_lUnion (lA, lB) | |
| Union between two lists (or) | |
Detailed Description
Package to load : lib/std/list.pkg
Function Documentation
| std_lCat | ( | p | , |
| q | |||
| ) |
Concat two list to one.
Prototype: fun [[u0 r1] [u0 r1]] [u0 r1]
- Parameters
-
[u0 r1] : first list to concat [u0 r1] : second list to concat
- Returns
- [u0 r1] : concatened list
| std_lExtractList | ( | list | , |
| e | , | ||
| func | |||
| ) |
Extract a list in two sub list.
Prototype: fun [[u0 r1] u0 fun [u0 u0] I] [u0 r1]
- Parameters
-
[u0 r1] : any list u0 : the seperator (an element of the list) fun [u0 u0] I : function to call to test
- Returns
- [[u0 r1] [u0 r1]] : two sub lists
| std_lSortList | ( | l | , |
| f | |||
| ) |
Sort a list.
Prototype: fun [[u0 r1] fun [u0 u0] I] [u0 r1]
- Parameters
-
[u0 r1] : list to sort fun [u0 u0] I : function to test
- Returns
- [u0 r1] : the sorted list
| 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]
- Parameters
-
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.
- Returns
- [[u0 r1] [u0 r1]] : a tuple with the two sub list
| std_lQuickSort | ( | list | , |
| func | |||
| ) |
Sort a list using an external function.
Prototype: fun [[u0 r1] fun [u0 u0] I] [u0 r1]
- Parameters
-
[u0 r1] : list to sort fun [u0 u0] I : function for sort test
- Returns
- [u0 r1] : sorted list
| std_lReverse | ( | list | ) |
Reverse a list (perform a mirror)
Prototype: fun [[u0 r1]] I
- Parameters
-
[u0 r1] : list to revert
- Returns
- [u0 r1] : reversed list
| std_lSub | ( | list | , |
| start | , | ||
| end | |||
| ) |
Extract a list between to indices.
Prototype: fun [[u0 rI] I I] [u0 r1]
- Parameters
-
[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.
- Returns
- I : the sub-list
| std_lSplit | ( | l | , |
| pos | |||
| ) |
Split a list in two list at given position.
Prototype: fun [[u0 r1] I] [[u0 r1] [u0 r1]]
- Parameters
-
[u0 r1] : list to split I : position (start at 0), use a negative value for a position from the list end
- Returns
- [[u0 r1] [u0 r1]] : splited list (two sub lists)
| 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
- Returns
- [[u0 r1] [u0 r1]]
| 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
- Returns
- [[[S r1] r1] [[S r1] r1]]
| std_lQuicksort | ( | l | , |
| f | |||
| ) |
brief Sort a list
Prototype: fun [[u0 r1] fun [u0 u0] I] [u0 r1]
- Parameters
-
[u0 r1] : list to sort fun [u0 u0] I : function for sort test
- Returns
- [u0 r1] : sorted list
| std_lQuicksortString | ( | l | , |
| f | |||
| ) |
Sort a string list.
Prototype: fun [[S r1] fun [S S] I] [S r1]
- Parameters
-
[S r1] : list to sort fun [S S] I : function for sort test
- Returns
- [S r1] : sorted list
| std_lApplyFunc | ( | list | , |
| f | , | ||
| x | |||
| ) |
apply a function to a list
Prototype: fun [[u0 r1] fun [u0 u1] u0 u1] [u0 r1]
- Parameters
-
[u0 r1] : a list fun [u0 u1] u0 : the function to call for each list element u1 : a user parameter
- Returns
- [u0 r1] : the new list
| 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]
- Parameters
-
[u0 r1] : a list u0 : the list element to remove
- Returns
- [u0 r1] : the list without the element
| std_lRemoveElt | ( | list | , |
| e | |||
| ) |
Remove an element in a list.
Prototype: fun [[u0 r1] u0] [u0 r1]
- Parameters
-
[u0 r1] : a list u0 : the list element to remove
- Returns
- [u0 r1] : the list without the element
| std_lRemoveStr | ( | list | , |
| e | |||
| ) |
Remove an string in a list. Case-sensitive.
Prototype: fun [[S r1] S] [S r1]
- Parameters
-
[S r1] : a list S : the list element to remove
- Returns
- [S r1] : the same list without the element
| std_lRemoveStri | ( | list | , |
| e | |||
| ) |
Remove an string in a list. Case-insensitive.
Prototype: fun [[S r1] S] [S r1]
- Parameters
-
[S r1] : a list S : the list element to remove
- Returns
- [S r1] : the same list without the element
| std_lEltPos | ( | list | , |
| e | |||
| ) |
Return the position of an element.
Prototype: fun [[u0 r1] u0] I
- Parameters
-
[u0 r1] : a list u0 : an element to found
- Returns
- I : its position or nil if not found
| std_lEltPosStr | ( | list | , |
| e | |||
| ) |
Return the position of a string element case sensitive.
Prototype: fun [[S r1] S] I
- Parameters
-
[S r1] : a list S : an element to found
- Returns
- I : its position or nil if not found
| std_lEltPosStri | ( | list | , |
| e | |||
| ) |
Return the position of a string element case insensitive.
Prototype: fun [[S r1] S] I
- Parameters
-
[S r1] : a list S : an element to found
- Returns
- I : its position or nil if not found
| std_lEltPosFunc | ( | list | , |
| f | , | ||
| e | |||
| ) |
Return the position of an element.
Prototype: fun [[u0 r1] fun [u0 u0] I u0] I
- Parameters
-
[u0 r1] : a list fun [u0 u0] I : a function to compare, should return 1 if ok u0 : an element to found
- Returns
- I : its position or nil if not found
| std_lIsInList | ( | list | , |
| e | |||
| ) |
Check if a value is in a given list.
Prototype: fun [[u0 r1] u0] I
- Parameters
-
[u0 r1] : a list u0 : an element to found
- Returns
- I : 0 if found or 1 if not 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
- Parameters
-
[u0 r1] : a list fun [u0 u0] I : a function to compare, should return 1 if ok u0 : an element to found
- Returns
- I : 0 if found or 1 if not found
| std_lStrIsInList | ( | list | , |
| e | |||
| ) |
Check if a string is in a given string list case sensitive.
Prototype: fun [[S r1] S] I
- Parameters
-
[S r1] : a list S : an element to found
- Returns
- I : 0 if found or 1 if not found
| std_lStriIsInList | ( | list | , |
| e | |||
| ) |
Check if a string is in a given string list case insensitive.
Prototype: fun [[S r1] S] I
- Parameters
-
[S r1] : a list S : an element to found
- Returns
- I : 0 if found or 1 if not found
| std_lEltCmp | ( | a | , |
| b | |||
| ) |
Conivience function to compare two elements (string excepted)
Prototype: fun [u0 u0] I
\param u0 : an element \param u0 : another element \return I : 1 if equal
| std_lEltNCmp | ( | a | , |
| b | |||
| ) |
Conivience function to compare two elements (string excepted)
Prototype: fun [u0 u0] I
\param u0 : an element \param u0 : another element \return I : 1 if not equal
| std_lEltSmaller | ( | a | , |
| b | |||
| ) |
Conivience function to compare two elements.
Prototype: fun [u0 u0] I
\param u0 : an element, generally an integer \param u0 : another element, generally another integer \return I : 1 if the first argument is smaller then the second argument
| std_lEltBigger | ( | a | , |
| b | |||
| ) |
Conivience function to compare two elements.
Prototype: fun [u0 u0] I
- Parameters
-
u0 : an element, generally an integer u0 : another element, generally another integer
- Returns
- I : 1 if the first argument is bigger then the second argument
| std_lSetUnique | ( | lSrc | ) |
Remove all supplemental elements. The list will have unique elements only.
Prototype: fun [[u0 r1]] [u0 r1]
- Parameters
-
[u0 r1] : a list
- Returns
- [u0 r1] : the same list with unique elements only
| 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]
- Parameters
-
[u0 r1]: a list fun [u0 u0] I : function to test, at your convenience
- Returns
- [u0 r1] : the same list with unique elements only
- See Also
- std_lSetUnique
| std_lReplaceElement | ( | lSrc | , |
| oldElt | , | ||
| newElt | |||
| ) |
Replace an element by other one.
Prototype: fun [[u0 r1] u0 u0] [u0 r1]
- Parameters
-
[u0 r1] : a list u0 : element to replace u0 : new element
- Returns
- [u0 r1] : the same list with the replacement
| std_lReplaceElementStr | ( | lSrc | , |
| oldS | , | ||
| newS | |||
| ) |
Replace an string by other one Case sensitive.
Prototype: fun [[S r1] S S] [S r1]
- Parameters
-
[S r1] : a list S : a string to replace S : a new string
- Returns
- [S r1] : the same list with the replacement
| std_lReplaceElementStri | ( | lSrc | , |
| oldS | , | ||
| newS | |||
| ) |
Replace an string by other one Case insensitive.
Prototype: fun [[S r1] S S] [S r1]
- Parameters
-
[S r1] : a list S : a string to replace S : a new string
- Returns
- [S r1] : the same list with the replacement
| std_lIntersection | ( | lA | , |
| lB | |||
| ) |
Intersection between two lists (and)
Prototype: fun [[u0 r1] [u0 r1]] [u0 r1]
- Parameters
-
[u0 r1] : a first list (ex : 0::2::4::6::nil) [u0 r1] : a second list (ex : 0::3::6::nil)
- Returns
- [u0 r1]: the intersection (ex : 0::6::nil)
| std_lUnion | ( | lA | , |
| lB | |||
| ) |
Union between two lists (or)
Prototype: fun [[u0 r1] [u0 r1]] [u0 r1]
- Parameters
-
[u0 r1] : a first list (ex : 0::2::4::6::nil) [u0 r1] : a second list (ex : 0::3::6::nil)
- Returns
- [u0 r1]: the union (ex : 0::2::3::4::6::nil)
- Remarks
- the output list is not sorted.
| std_lDifference | ( | lA | , |
| lB | |||
| ) |
Difference between two lists.
Prototype: fun [[u0 r1] [u0 r1]] [u0 r1]
- Parameters
-
[u0 r1] : a first list (ex : 0::2::4::6::nil) [u0 r1] : a second list (ex : 0::3::6::nil)
- Returns
- [u0 r1]: the difference (ex : 1st - 2nd : 2::4::nil ; 2nd - 1st : 3::nil)
| std_lDifferenceSym | ( | lA | , |
| lB | |||
| ) |
Symetric difference between two lists (xor)
Prototype: fun [[u0 r1] [u0 r1]] [u0 r1]
- Parameters
-
[u0 r1] : a first list (ex : 0::2::4::6::nil) [u0 r1] : a second list (ex : 0::3::6::nil)
- Returns
- [u0 r1]: the sym. diff. (ex : 2::3::4::nil)
| std_lInclude | ( | lA | , |
| lB | |||
| ) |
Returns if a list is included in another one.
Prototype: fun [[u0 r1] [u0 r1]] I
- Parameters
-
[u0 r1] : a list to check (ex : 2::4::nil) [u0 r1] : another list (ex : 0::2::4::6::nil)
- Returns
- I : 1 if the first list is included in the second, else 0 (ex : 1)
| 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
- Parameters
-
[u0 r1] : a list to check (ex : 2::4::nil) [u0 r1] : another list (ex : 0::2::4::6::nil)
- Returns
- I : 1 if yes, else 0 (ex : 0)
| 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
- Parameters
-
[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.
- Returns
- I : the result : 1 if equals, 0 else
Generated on Sat Jan 31 2015 19:15:44 for Scol standard library package by
1.8.1.2

