OpenSpace3D libs
OpenSpace 3D libraries for plugITs and OS3D developer
Functions

Functions

 lcat (p, q)
 Concat two list to one.
 
 splitList (l, pos)
 Split a list in two list at given position.
 
 moveListElement (l, pos, to)
 move an elements in a list
 
 quicksort (l, f)
 Sort a list.
 
 quicksortByPos (l, pos, f)
 Sort a list by position.
 
 quicksortList (l, f)
 Sort a string list.
 
 quicksort3 (l, f)
 Sort a string list.
 
 sortlist (l, f)
 Sort a list.
 
 revertlist (list)
 Reverse a list.
 
 isStringInList (l, string)
 Test if a string exist in a list.
 
 isStringInListi (l, string)
 Test if a string exist in a list case insensitivity.
 
 isStringInListiPos (l, string, pos, length)
 Test if a string exist in a list case insensitivity.
 
 addUniqueStr (l, str)
 Add a string element as unique.
 
 addUniqueStri (l, str)
 Add a string element as unique, case insensitivity.
 
 getStringPosInList (l, string)
 get a string position in a list
 
 getStringPosInListi (l, string)
 get a string position in a list case insensitivity
 
 isFirstWordInList (l, string)
 Test if a string exist in a list as the first word of the string.
 
 isFirstWordInListi (l, string)
 Test if a string exist in a list as the first word of the string case insensitivity.
 
 isFirstStringInList (l, string)
 Test if the first string of a list match to a word.
 
 isT1InList (l, val)
 Test if the first tuple value in list is present.
 
 isT2InList (l, val)
 Test if the second tuple value in list is present.
 
 listLowercase (l)
 Transform a string list to lowercase.
 
 apply_on_list (l, f, x)
 apply a function to a list
 
 rev_apply_on_list (l, f, x)
 apply a function to a list reserved
 
 search_in_list (l, f, x)
 Search an element in a list.
 
 remove_from_list (l, p)
 Remove an element in a list.
 
 remove_string_from_list (l, elt)
 Remove an string in a list.
 
 remove_idx_from_list (l, idx)
 Remove an indexed element in a list.
 
 remove_sid_from_list (l, sid)
 Remove a string indexed element in a list.
 
 remove_sid_from_listi (l, sid)
 Remove a string indexed element in a list case incensivity.
 
 rename_sid_from_list (l, sid, nid)
 Rename a string indexed element in a list.
 

Detailed Description

List tools

Function Documentation

◆ lcat()

lcat ( ,
 
)

Concat two list to one.

Prototype: fun [[u0 r1] [u0 r1]] [u0 r1]

Parameters
[u0r1] : first list to concat
[u0r1] : second list to concat
Returns
[u0 r1] : concatened list

◆ splitList()

splitList ( ,
pos   
)

Split a list in two list at given position.

Prototype: fun [[u0 r1] I] [[u0 r1] [u0 r1]]

Parameters
[u0r1] : 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

◆ moveListElement()

moveListElement ( ,
pos  ,
to   
)

move an elements in a list

Prototype: fun [[u0 r1] I I] [u0 r1]

Parameters
[u0r1] : list to split
I: position to get the element
I: position to move the element
Returns
[u0 r1] : new list

◆ quicksort()

quicksort ( ,
 
)

Sort a list.

Prototype: fun [[u0 r1] fun [u0 u0] I] [u0 r1]

Parameters
[u0r1] : list to sort
fun[u0 u0] I : function for sort test (suppDoublon for example)
Returns
[u0 r1] : sorted list

◆ quicksortByPos()

quicksortByPos ( ,
pos  ,
 
)

Sort a list by position.

Prototype: fun [[[u0 r1] r1] I fun [u0 u0] I] [[u0 r1] r1]

Parameters
[u0r1] : list to sort
fun[u0 u0] I : function for sort test (suppDoublon for example)
Returns
[[u0 r1] r1] : sorted list

◆ quicksortList()

quicksortList ( ,
 
)

Sort a string list.

Prototype: fun [[[S r1] r1] fun [S S] I] [S r1]

Parameters
[[Sr1] r1] : list to sort
fun[S S] I : function for sort test (suppDoublon for example)
Returns
[S r1] : sorted list

◆ quicksort3()

quicksort3 ( ,
 
)

Sort a string list.

Prototype: fun [[[[S u0] r1] r1]] fun [S S] I] [[[S u0] r1] r1]]

Parameters
[Sr1] : list to sort
fun[S S] I : function for sort test (suppDoublon for example)
Returns
[[[S u0] r1] r1]] : sorted list

◆ sortlist()

sortlist ( ,
 
)

Sort a list.

Prototype: fun [[u0 r1] fun [u0 u0] I] [u0 r1]

Parameters
[u0r1] : list to sort
fun[u0 u0] I : function for sort test (suppDoublon for example)
Returns
[u0 r1] : sorted list

◆ revertlist()

revertlist ( list  )

Reverse a list.

Prototype: fun [[u0 r1]] I

Parameters
[u0r1] : list to revert
Returns
[u0 r1] : reversed list

◆ isStringInList()

isStringInList ( ,
string   
)

Test if a string exist in a list.

Prototype: fun [[S r1] S] I

Parameters
[Sr1] : list
S: string to search
Returns
I : 1 if the string exist in the list 0 otherwise

◆ isStringInListi()

isStringInListi ( ,
string   
)

Test if a string exist in a list case insensitivity.

Prototype: fun [[S r1] S] I

Parameters
[Sr1] : list
S: string to search
Returns
I : 1 if the string exist in the list 0 otherwise

◆ isStringInListiPos()

isStringInListiPos ( ,
string  ,
pos  ,
length   
)

Test if a string exist in a list case insensitivity.

Prototype: fun [[S r1] S I I] I

Parameters
[Sr1] : list
S: string to search
I: position
I: length
Returns
I : 1 if the string exist in the list 0 otherwise

◆ addUniqueStr()

addUniqueStr ( ,
str   
)

Add a string element as unique.

Prototype: fun [[S r1] S] [S r1]

Parameters
[Sr1] : list
S: unique element
Returns
[S r1] : new list

◆ addUniqueStri()

addUniqueStri ( ,
str   
)

Add a string element as unique, case insensitivity.

Prototype: fun [[S r1] S] [S r1]

Parameters
[Sr1] : list
S: unique element
Returns
[S r1] : new list

◆ getStringPosInList()

getStringPosInList ( ,
string   
)

get a string position in a list

Prototype: fun [[S r1] S] I

Parameters
[Sr1] : list
S: string to search
Returns
I : string position or nil if not found

◆ getStringPosInListi()

getStringPosInListi ( ,
string   
)

get a string position in a list case insensitivity

Prototype: fun [[S r1] S] I

Parameters
[Sr1] : list
S: string to search
Returns
I : string position or nil if not found

◆ isFirstWordInList()

isFirstWordInList ( ,
string   
)

Test if a string exist in a list as the first word of the string.

Prototype: fun [[S r1] S] I

Parameters
[Sr1] : list
S: string to search
Returns
I : 1 if the string exist in the list 0 otherwise

◆ isFirstWordInListi()

isFirstWordInListi ( ,
string   
)

Test if a string exist in a list as the first word of the string case insensitivity.

Prototype: fun [[S r1] S] I

Parameters
[Sr1] : list
S: string to search
Returns
I : 1 if the string exist in the list 0 otherwise

◆ isFirstStringInList()

isFirstStringInList ( ,
string   
)

Test if the first string of a list match to a word.

Prototype: fun [[[S r1] r1] S] I

Parameters
[[Sr1] r1] : list
S: string to compare
Returns
I : 1 if the string exist in the list 0 otherwise

◆ isT1InList()

isT1InList ( ,
val   
)

Test if the first tuple value in list is present.

Prototype: fun [[[u0 u1] r1] u0] I

Parameters
[[Iu0] r1] : list
u0: value to compare
Returns
I : 1 if the value exist in the list 0 otherwise

◆ isT2InList()

isT2InList ( ,
val   
)

Test if the second tuple value in list is present.

Prototype: fun [[[u0 u1] r1] u1] I

Parameters
[[Iu0] r1] : list
u1: value to compare
Returns
I : 1 if the value exist in the list 0 otherwise

◆ listLowercase()

listLowercase ( )

Transform a string list to lowercase.

Prototype: fun [[S r1]] [S r1]

Parameters
[Sr1] : the string list
Returns
[S r1] : the same string list with lowercase values

◆ apply_on_list()

apply_on_list ( ,
,
 
)

apply a function to a list

Prototype: fun [[u0 r1] fun [u0 u1] I u1] I

Parameters
[u0r1] : the list
fun[u0 u1] I : the function to call for each list element
u1: a user parameter
Returns
I : 0

◆ rev_apply_on_list()

rev_apply_on_list ( ,
,
 
)

apply a function to a list reserved

Prototype: fun [[u0 r1] fun [u0 u1] u0 u1] [u0 r1]

Parameters
[u0r1] : the list
fun[u0 u1] u0 : the function to call for each list element
u1: a user parameter
Returns
[u0 r1] : the new list

◆ search_in_list()

search_in_list ( ,
,
 
)

Search an element in a list.

Prototype: fun [[u0 r1] fun [u0 u1] I u1] u0

Parameters
[u0r1] : the list
fun[u0 u1] I : the function to call for each list element to compare
u1: a user parameter
Returns
u0 : the element found or nil

◆ remove_from_list()

remove_from_list ( ,
 
)

Remove an element in a list.

Prototype: fun [[u0 r1] u0] [u0 r1]

Parameters
[u0r1] : the list
u0: the list element to remove
Returns
[u0 r1] : the list without the element

◆ remove_string_from_list()

remove_string_from_list ( ,
elt   
)

Remove an string in a list.

Prototype: fun [[S r1] S] [S r1]

Parameters
[Sr1] : the list
S: the list element to remove
Returns
[S r1] : the list without the element

◆ remove_idx_from_list()

remove_idx_from_list ( ,
idx   
)

Remove an indexed element in a list.

Prototype: fun [[[u0 u1] r1] u0] [[u0 u1] r1]

Parameters
[[u0u1] r1] : the list
u0: the index to remove
Returns
[[u0 u1] r1] : the list without the element

◆ remove_sid_from_list()

remove_sid_from_list ( ,
sid   
)

Remove a string indexed element in a list.

Prototype: fun [[[S u0] r1] S] [[S u0] r1]

Parameters
[[Su0] r1] : the list
S: the index to remove
Returns
[[S u0] r1] : the list without the element

◆ remove_sid_from_listi()

remove_sid_from_listi ( ,
sid   
)

Remove a string indexed element in a list case incensivity.

Prototype: fun [[[S u0] r1] S] [[S u0] r1]

Parameters
[[Su0] r1] : the list
S: the index to remove
Returns
[[S u0] r1] : the list without the element

◆ rename_sid_from_list()

rename_sid_from_list ( ,
sid  ,
nid   
)

Rename a string indexed element in a list.

Prototype: fun [[[S u0] r1] S S] [[S u0] r1]

Parameters
[[Su0] r1] : the list
S: the index to rename
S: the new index name
Returns
[[S u0] r1] : the list updated