3 ms·
Do you mean something like this: f(arg1, arg2, arg3, deps)?
by osigurdson 4y ago
Do you mean something like this: f(arg1, arg2, arg3, deps)?
- Akronymus 4y agoAs I am not familiar with TS, I am gonna use F# as an example: let sort (iterator: 'b -> 'a list) (collector: 'a list -> 'c) (comparator: 'a -> 'a -> bool) (collection: 'b) -> 'c = ... I added the type annotations to, hopefully make it clear. The iterator is a helper to convert some arbitrary collection to a list, with the collector turning it back into a collection type again (not necessarily the same.) For example, the iterator could map from a tree to a list, and the collector then to an array. Or if you already have a list and want a list back, you could pass in the identity function for those. One call could be the following: sort id id (>) somelist Hope it isn't too unreadable. Edit: Adjusted the order of the arguments, as the original order wouldn't work too well with partial application.