From: Neil M. <nei...@gm...> - 2012-08-15 19:09:33
|
On 15 Aug 2012, at 10:06, "Trevor Davel (Twylite)" <tw...@cr...> wrote > On 2012/08/15 09:22 AM, Neil Madden wrote: >> Incidentally, should lmap itself be a concatMap? > No. In the trivial (and most common) [citation needed!] > case where the map outputs 1 value per input, each of the output values would need to be list quoted. This is unnecessary overhead (in source code and runtime work), unintuitive (*1), and inherently unsafe (*2). Right, but the alternative can *only* handle strict 1 to 1 mapping. > > Intuitively I would expect the following code to produce a list of greetings, not a list of words, and certainly not an error 'unmatched open brace in list': > > set greetings [lmap name {"world" "dolly" "there sailor"} { > set x "hello $name {" > }] This can of course be sugared: interp alias {} emit {} list lmap name ... { emit "hello $name {" } But I'll bow to peer pressure that the simpler version is more intuitive and easier to implement. Neil |