Type | Wish | Status | reviewed | Date | 18-Jun-2014 11:06 |
---|---|---|---|---|---|
Version | r3 master | Category | Native | Submitted by | fork |
Platform | All | Severity | minor | Priority | normal |
Summary | Allow MAP-EACH to work on any-string! |
---|---|
Description |
It would be nice if map-each could take a string in and give a string back. >> map-each ch "abc<def>ghi&jkl" [ switch/default ch [ #"<" ["<"] #">" [">"] #"&" ["&"] ] [ ch ] ] == "abc<def>ghi&" The concept here would be that it would take in a string, give it to you character-by-character, and then you could produce a character or string to add to what ultimately becomes a string output. |
Example code |
Assigned to | n/a | Fixed in | - | Last Update | 22-Jun-2014 02:35 |
---|
Comments | |
---|---|
(0004460)
BrianH 22-Jun-2014 02:35 |
MAP-EACH should work on strings, but shouldn't by default return a string, it should continue to return a block; that would make it more useful for polymorphic code. Making it return a string should be done with an /as option (similar to #724, with errors triggered for incompatible types), or with an /into option (#709); that would also make it more useful for polymorphic code. Why should the type of the input constrain the output type, when we could have controlled conversion? See #2081 for an example of this kind of controlled conversion. |
Date | User | Field | Action | Change |
---|---|---|---|---|
22-Jun-2014 07:45 | BrianH | Comment : 0004460 | Modified | - |
22-Jun-2014 02:35 | BrianH | Description | Modified | - |
22-Jun-2014 02:35 | BrianH | Category | Modified | Unspecified => Native |
22-Jun-2014 02:35 | BrianH | Status | Modified | submitted => reviewed |
22-Jun-2014 02:35 | BrianH | Comment : 0004460 | Added | - |
18-Jun-2014 11:06 | Fork | Ticket | Added | - |