code/__HELPERS/_lists.dm
LAZY_LISTS_OR | ORs two lazylists together without inserting errant nulls, returning a new list and not modifying the existing lists. |
---|---|
LAZYORASSOCLIST | Performs an insertion on the given lazy list with the given key and value. If the value already exists, a new one will not be made. |
COMPARE_KEY | Passed into BINARY_INSERT to compare keys |
COMPARE_VALUE | Passed into BINARY_INSERT to compare values |
BINARY_INSERT | Binary search sorted insert INPUT: Object to be inserted LIST: List to insert object into TYPECONT: The typepath of the contents of the list COMPARE: The object to compare against, usualy the same as INPUT COMPARISON: The variable on the objects to compare COMPTYPE: How should the values be compared? Either COMPARE_KEY or COMPARE_VALUE. |
BINARY_INSERT_PROC_COMPARE | Custom binary search sorted insert utilising comparison procs instead of vars. INPUT: Object to be inserted LIST: List to insert object into TYPECONT: The typepath of the contents of the list COMPARE: The object to compare against, usualy the same as INPUT COMPARISON: The plaintext name of a proc on INPUT that takes a single argument to accept a single element from LIST and returns a positive, negative or zero number to perform a comparison. COMPTYPE: How should the values be compared? Either COMPARE_KEY or COMPARE_VALUE. |
/proc/is_type_in_list | Checks for specific types in a list. |
/proc/expand_weights | Takes a weighted list (see above) and expands it into raw entries This eats more memory, but saves time when actually picking from it |
/proc/greatest_common_factor | Takes a list of numbers as input, returns the highest value that is cleanly divides them all Note: this implementation is expensive as heck for large numbers, I only use it because most of my usecase Is < 10 ints |
/proc/pick_n_take | Pick a random element from the list and remove it from the list. |
/proc/bitfield_to_list | Converts a bitfield to a list of numbers (or words if a wordlist is provided) |
/proc/find_record | Returns datum/data/record |
Define Details
BINARY_INSERT
Binary search sorted insert INPUT: Object to be inserted LIST: List to insert object into TYPECONT: The typepath of the contents of the list COMPARE: The object to compare against, usualy the same as INPUT COMPARISON: The variable on the objects to compare COMPTYPE: How should the values be compared? Either COMPARE_KEY or COMPARE_VALUE.
BINARY_INSERT_PROC_COMPARE
Custom binary search sorted insert utilising comparison procs instead of vars. INPUT: Object to be inserted LIST: List to insert object into TYPECONT: The typepath of the contents of the list COMPARE: The object to compare against, usualy the same as INPUT COMPARISON: The plaintext name of a proc on INPUT that takes a single argument to accept a single element from LIST and returns a positive, negative or zero number to perform a comparison. COMPTYPE: How should the values be compared? Either COMPARE_KEY or COMPARE_VALUE.
COMPARE_KEY
Passed into BINARY_INSERT to compare keys
COMPARE_VALUE
Passed into BINARY_INSERT to compare values
LAZYORASSOCLIST
Performs an insertion on the given lazy list with the given key and value. If the value already exists, a new one will not be made.
LAZY_LISTS_OR
ORs two lazylists together without inserting errant nulls, returning a new list and not modifying the existing lists.