Re:Streem – a new programming language from Matz
by nostrademons on Thursday December 11, 2014 @02:48PM
(#8736691)
The one-liner is valid Python. It's slightly non-idiomatic in that it uses a list-comprehension where a generator expression would do, and uses range instead of xrange (in Python 2.x; in 3.x range is the idiomatic alternative).
Re:Streem – a new programming language from Matz
by nightpool on Thursday December 11, 2014 @03:05PM
(#8736781)
it's also non-idomatic in that is uses string-multiplication and ==0 where an "if not" ternary expression would be much cleaner.
Re:Streem – a new programming language from Matz
by SwellJoe on Thursday December 11, 2014 @04:12PM
(#8737087)
Yes, a ternary would be clearer, to me. I wasn't sure what was happening with the * (and thought maybe it was some use of the "whatever star" in Perl 6, when I was thinking it might be Perl 6, though it doesn't look like any use of the whatever star I've seen), but I just assumed it made sense to someone who knew the language well. It's been a decade since I worked in Python with any regularity.
Re:Streem – a new programming language from Matz
by nostrademons on Thursday December 11, 2014 @04:23PM
(#8737129)
I would probably use a named function call in real code, but the 'text * (expr == 0)' idiom is pretty clear to me as a way to conditionally include text based on whether a condition is true or not.
I don't even recognize the language of the one-liner, but it makes perfect sense to me as a reader. It looks like a Perlish solution, but the string method is strange, I think. Maybe Perl 6 or Ruby?