Files
swift-mirror/test/Interpreter/reverse.swift
Dave Abrahams 6b0d2f92f0 [stdlib] Give reverse() the lazy() treatment
This one shows the unfortunate consequence that we need
Lazy[Forward|Bidirectional|RandomAccess]Collection.  There's gonna be a
whole lotta gyb'bing going on...

Swift SVN r19316
2014-06-28 01:35:34 +00:00

28 lines
398 B
Swift

// RUN: %target-run-simple-swift | FileCheck %s
func test()
{
print("[")
for i in lazy(0..<10).reverse() {
print(i)
print(" ")
}
print("]\n")
}
func testr()
{
print("[")
for i in lazy(0..<10).reverse().reverse() {
print(i)
print(" ")
}
print("]\n")
}
test()
testr()
// CHECK: [9 8 7 6 5 4 3 2 1 0 ]
// CHECK: [0 1 2 3 4 5 6 7 8 9 ]