Timeline for The gap between MapAt and ReplacePart for 2D data tables with headers
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 20, 2012 at 21:51 | vote | accept | alancalvitti | ||
| Aug 10, 2012 at 21:01 | comment | added | Mr.Wizard | @Simon Thanks. Indeed you could, but you slow down the matching as every alternative is tried twice on expressions that don't match. (EDIT: I realize I wrote "Golf" but I was actually seeking to make it practical, if a bit obfuscated.) | |
| Aug 10, 2012 at 12:17 | comment | added | Simon Woods | @Mr.Wizard, I love it. Especially the use of a pattern which will never match anything :-) Could also use q|q there. | |
| Aug 10, 2012 at 11:29 | comment | added | Mr.Wizard | @Simon or to Golf it: transform[data_, {q__}, fun_] := (data\[Transpose] /. {id : q | _?0, x__} :> {id} ~Join~ fun@{x})\[Transpose] | |
| Aug 10, 2012 at 10:24 | comment | added | Simon Woods | I like the simplicity. IMO it would be even more readable to use {id : Alternatives @@ q, x__} :> {id}~Join~fun@{x} as the replacement rule. | |
| Aug 9, 2012 at 21:47 | history | answered | rm -rf♦ | CC BY-SA 3.0 |