■ C
for( const char *s="12345"; *s; ++s ) if( '2'<*s&&*s<'5' ) printf( "%d", (*s-'0')*2 );
console.log([1,2,3,4,5].filter(function (i){ return (i > 2 && i < 5 ); }).map(function(i){ return 2 * i; }));
■ Python
print(map(lambda x: x*2, filter(lambda x: x>2 and x<5, [1,2,3,4,5])))
■ Ruby
puts [1,2,3,4,5].select{|i| i > 2 and i < 5}.map{|i| i*2}
■ C#
new{}{ 1,2,3,4,5 }.Where(x => 2 < x && x < 5).Select(x => x*2);
(print (loop for x in '(1 2 3 4 5) if (< 2 x 5) collect (* x 2)))
■ Haskell
print [x*2| x <-[1,2,3,4,5], x > 2, x < 5]
■ J
■ R
print((function(){x<-c(1,2,3,4,5);x[2<x&x<5]*2})())</p>
■ Clojure
(print (for [x [1,2,3,4,5] :when (< 2 x 5)] (* x 2)))
(1 to: 5) select: [:x | x between: 3 and: 4] thenCollect: [:x | x * 2]
for(int i=1;(i-6)==0;i++) { if( !((i-3) & ~1)) { printf("%d¥n",2*i); } }
pythonはその場合、内包表記ではないだろうか。 print([x*2 for x in [1,2,3,4,5] if 2<x<5]) [1,2,3,4,5]はrange(1,5)に置き換えれるが、他と合わせてみた。