• code fp Swift
    5> [1,2,3].map { $1 * 10 }
    <repl>:5:9: error: type '(($T7, ($T7, $T8) -> ($T7, $T8) -> $T6) -> ($T7, ($T7, $T8) -> $T6) -> $T6, (($T7, $T8) -> ($T7, $T8) -> $T6, $T8) -> (($T7, $T8) -> $T6, $T8) -> $T6)' does not conform to protocol 'IntegerLiteralConvertible'
    
    6> let x = [1,2,3]
    x: [Int] = 3 values {
      [0] = 1
      [1] = 2
      [2] = 3
    }
    
    7> x.map { $1 * 10 }
    <REPL>:8:7: error: 'Int' is not a subtype of '(($T5, ($T5, $T6) -> ($T5, $T6) -> $T4) -> ($T5, ($T5, $T6) -> $T4) -> $T4, (($T5, $T6) -> ($T5, $T6) -> $T4, $T6) -> (($T5, $T6) -> $T4, $T6) -> $T4)'
    x.map { $1 }
    
    и эти люди ругают С++ за сообщения об ошибках...
    inb4, правильный код --  x.map { $0 * 10 }

Replies (0)