digitalmars.D.bugs - [Issue 10379] New: std.string.translate (and others) for a Range of characters
- d-bugmail puremagic.com (27/27) Jun 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10379
- d-bugmail puremagic.com (18/18) Jun 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10379
- d-bugmail puremagic.com (14/15) Jun 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10379
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 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: -------
Jun 16 2013
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 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: -------
Jun 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10379I'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: -------
Jun 17 2013