             { block(i) }
     }
     dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
-    
-}+}
+
+public func block<B>(_ block: () -> B) -> B {
+    return block()
+}
+
+public func block<B>(_ block: () throws -> (B)) throws -> B {
+    return try block()
+}
+

}

@warn_unused_result
public func asyncUnordered<S : Sequence, U  where S.Iterator.Element : Hashable>
    (_ sequence: S, _ block: (S.Iterator.Element) -> U)
    -> [U] {
        
        let group = dispatch_group_create()!
        var arr : [U] = []
        let lockQueue = dispatch_queue_create("Math.LoopLockQueue", nil)!
        
        for i in sequence {
            dispatch_group_async(group, dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0)) {
                let c = block(i)
                dispatch_sync(lockQueue) { arr.append(c) }
            }
        }
        dispatch_group_wait(group, DISPATCH_TIME_FOREVER)

}

@warn_unused_result
public func asyncWithIndex<S : Sequence where S.Iterator.Element : Hashable>
    (_ sequence: S, _ block: (S.Iterator.Element) throws -> Any)
    -> [S.Iterator.Element:Any] {
        
        let group = dispatch_group_create()!
        var dict : [S.Iterator.Element:Any] = [:]
        let lockQueue = dispatch_queue_create("Math.LoopLockQueue", nil)!
        
        for i in sequence {
            dispatch_group_async(group, dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0)) {
                do {
                    let c = try block(i)
                    dispatch_sync(lockQueue) { dict[i] = c }
                } catch let e {
                    dispatch_sync(lockQueue) { dict[i] = e }
                }
            }
        }
        dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
