Thread overview | |||||
---|---|---|---|---|---|
|
June 16, 2013 [Issue 10379] New: std.string.translate (and others) for a Range of characters | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=10379 Summary: std.string.translate (and others) for a Range of characters Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2013-06-16 06:53:53 PDT --- In Phobos I'd like a function like std.string.translate (or an overload of the same function) that works on a lazy Range of characters, instead of a string. This is useful to reduce the memory used when I have to process lot of data, to avoid the creation of many large intermediate strings. (One current workaround is to use chunks, and process each piece with the string functions). Probably it's useful for other similar string functions to accept a lazy Range of characters, like std.string.removechars, std.string.tr, std.array.replace, etc. (This also makes a function as std.string.tr even more similar to the Posix tr). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 17, 2013 [Issue 10379] std.string.translate (and others) for a Range of characters | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=10379 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-06-17 16:38:19 PDT --- I could imagine a generic version of it put into std.algorithm (where the translate hash table can have any Value type but the Key type would have to be the ElementType of the range), for example: ----- string[int] table = [1 : "one", 2 : "two"]; auto inputRange = ...; // some integer range inputRange.translate(table); ----- I'm not sure about the use-cases though. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 18, 2013 [Issue 10379] std.string.translate (and others) for a Range of characters | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=10379 --- Comment #2 from bearophile_hugs@eml.cc 2013-06-17 17:20:41 PDT --- (In reply to comment #1) > I'm not sure about the use-cases though. My request is about a translate (and other string functions) that works on a range of characters. Extending it to other kinds of data is possible, but fulfils different uses cases. Regarding my use case, if you have a very long string (multi megabytes) and you want to apply several string functions on it, every time they generate an intermediate very large string. This sometimes requires lot of memory. When there are even large streams of textual data you may not even have enough space to keep it whole in memory. In such cases I'd like lazy string functions. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation