This language bar is your friend. Select your favorite languages!

Idiom #143 Iterate alternatively over two lists

Iterate alternatively over the elements of the list items1 and items2. For each iteration, print the element.

(map (lambda (x)
       (display x)
       (newline))
     (foldr append '()
            (map list items1 items2)))
import std.range;
import std.algorithm.iteration;
import std.stdio;
roundRobin(items1, items2).each!writeln;
for i := 0; i < len(items1) || i < len(items2); i++ {
	if i < len(items1) {
		fmt.Println(items1[i])
	}
	if i < len(items2) {
		fmt.Println(items2[i])
	}
}
interweave :: [a] -> [a] -> [a]   -- optional signature
interweave [] ys = ys
interweave xs [] = xs
interweave (x:xs) (y:ys) = x : y : interweave xs ys

main = mapM_ print $ interweave items1 items2
[items1, items2].transpose.each{|ar| 
  ar.each{|item| p item }
}

Do you know the best way to do this in your language ?
New implementation...