Created
February 17, 2023 00:26
-
-
Save dabrahams/1f0628ffd964bf607ea93f266a81a5fa to your computer and use it in GitHub Desktop.
Swift repl / LLDB printing horror
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ val git:(interpreter) ✗ swift repl | |
Welcome to Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51). | |
Type :help for assistance. | |
1> let x = [[1], [2, 3]] | |
x: [[Int]] = 2 values { | |
[0] = 1 value { | |
[0] = 1 | |
} | |
[1] = 2 values { | |
[0] = 2 | |
[1] = 3 | |
} | |
} | |
2> x.joined() | |
$R0: FlattenSequence<[[Int]]> = { | |
_base = 2 values { | |
[0] = 1 value { | |
[0] = 1 | |
} | |
[1] = 2 values { | |
[0] = 2 | |
[1] = 3 | |
} | |
} | |
} | |
3> Array(x.joined()) | |
$R1: [FlattenSequence<[[Int]]>.Element] = 3 values { | |
[0] = 1 | |
[1] = 2 | |
[2] = 3 | |
} | |
4> let y = Array(x.joined()) | |
y: [FlattenSequence<[[Int]]>.Element] = 3 values { | |
[0] = 1 | |
[1] = 2 | |
[2] = 3 | |
} | |
5> print(y) | |
[1, 2, 3] | |
6> print(type(of: y)) | |
Array<Int> | |
7> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment