Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs generated from: feat: add Dynamic.String.to-array (#1382)
* feat: add Dynamic.String.to-array Adds a new dynamic function that converts a string to an array of strings, one for each character in the string. In other words, it's the same as Dynamic.String.to-list but the result is an array structure instead of a list. It's also significantly faster than to-list on large inputs. The current implementation of Dynamic.String.to-list takes long to process large inputs, presumably because of its recursive behavior and multiple calls to cons (I'm currently investigating this) (e.g. use read-file then try calling to-list, you may need to wait a while). Contrarily, to-array is nearly instantaneous even when the input string is large. This is because it leverages Haskell's `splitOn` directly, which, when given an empty delimiter, (which is the case for the empty string), splits the entire input sequence. Because "" is the empty list for a string in Haskell's representation, calling split-on with "" results in the splitting behavior. The output also includes the delimiting case, so we drop it using cdr. * test: add test for Dynamic.String.to-array
- Loading branch information