digitalmars.D.learn - Lazy std.algorithm.replace()
- =?UTF-8?B?Tm9yZGzDtnc=?= (2/2) Nov 01 2015 Is there a reason why Phobos doesn't contain a lazy range variant
- =?UTF-8?B?Tm9yZGzDtnc=?= (2/4) Nov 02 2015 Ping.
- =?UTF-8?Q?Ali_=c3=87ehreli?= (5/9) Nov 02 2015 What is the use case?
- =?UTF-8?B?Tm9yZGzDtnc=?= (12/24) Nov 02 2015 Chaining replacement with other filterings. I need in my
- =?UTF-8?B?Tm9yZGzDtnc=?= (4/8) Nov 07 2015 Moved stuff to
- Adam D. Ruppe (3/5) Nov 02 2015 Would something like map work with the predicate being
- =?UTF-8?B?Tm9yZGzDtnc=?= (3/8) Nov 02 2015 I'm already using `map` in the simple overloads (Range haystack,
Is there a reason why Phobos doesn't contain a lazy range variant of std.string.replace?
Nov 01 2015
On Sunday, 1 November 2015 at 14:26:21 UTC, Nordlöw wrote:Is there a reason why Phobos doesn't contain a lazy range variant of std.string.replace?Ping.
Nov 02 2015
On 11/02/2015 04:22 AM, Nordlöw wrote:On Sunday, 1 November 2015 at 14:26:21 UTC, Nordlöw wrote:What is the use case? The implementation doesn't seem trivial to me as it needs to maintain an internal buffer as large as the 'to' argument to do the mutation in. AliIs there a reason why Phobos doesn't contain a lazy range variant of std.string.replace?Ping.
Nov 02 2015
On Monday, 2 November 2015 at 19:53:09 UTC, Ali Çehreli wrote:On 11/02/2015 04:22 AM, Nordlöw wrote:Chaining replacement with other filterings. I need in my knowledge database (graph) i building...which a *lot* of string processing.On Sunday, 1 November 2015 at 14:26:21 UTC, Nordlöw wrote:What is the use case?Is there a reason why Phobos doesn't contain a lazy range variant of std.string.replace?Ping.The implementation doesn't seem trivial to me as it needs to maintain an internal buffer as large as the 'to' argument to do the mutation in. AliI'm aware of that. I'm done with the easy cases at https://github.com/nordlow/justd/blob/master/algorithm_ex.d#L1946 and https://github.com/nordlow/justd/blob/master/algorithm_ex.d#L1997 I'm planning to implement the most generic version where `haystack` and keys are both ranges by reusing std.algorithm : find`. Do you have any more advice on that overload?
Nov 02 2015
On Monday, 2 November 2015 at 20:22:11 UTC, Nordlöw wrote:I'm done with the easy cases at https://github.com/nordlow/justd/blob/master/algorithm_ex.d#L1946 and https://github.com/nordlow/justd/blob/master/algorithm_ex.d#L1997Moved stuff to https://github.com/nordlow/justd/blob/master/replacing.d for now.
Nov 07 2015
On Sunday, 1 November 2015 at 14:26:21 UTC, Nordlöw wrote:Is there a reason why Phobos doesn't contain a lazy range variant of std.string.replace?Would something like map work with the predicate being if(matches_needle) return replacement; else return original; ?
Nov 02 2015
On Monday, 2 November 2015 at 20:25:44 UTC, Adam D. Ruppe wrote:On Sunday, 1 November 2015 at 14:26:21 UTC, Nordlöw wrote:I'm already using `map` in the simple overloads (Range haystack, ElementType needle) mentioned in my previous post.Is there a reason why Phobos doesn't contain a lazy range variant of std.string.replace?Would something like map work with the predicate being if(matches_needle) return replacement; else return original; ?
Nov 02 2015