LWN.net Logo

On the future of Perl 5

On the future of Perl 5

Posted Dec 3, 2008 19:34 UTC (Wed) by jbh (subscriber, #494)
In reply to: On the future of Perl 5 by niner
Parent article: On the future of Perl 5

Right, I recognized it under the second name.

-- quote:
"foo %s bar %s, %s, %s, %s, %s" % (foo, bar, map(lambda x: baz(x), [1, 2, 3, 4]))
--

You could use list concatenation (+) to do something like

"foo %s bar %s, %s, %s, %s, %s" % tuple([foo, bar] + map(lambda x: baz(x), [1, 2, 3, 4]))

... which is slightly uglified by the "%" operator not accepting a list (hence the "tuple" call). But yeah, it would be handy to be able to use the argument list syntax in other places.

Still, 15 lines? :-)


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds