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
//: Playground - noun: a place where people can play | |
import Foundation | |
protocol Neuron { | |
var weights: [Double] {get} | |
func feedforward(input: [Double]) -> Double | |
func activation(input: Double) -> Double | |
} |
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
protocol Disposable { | |
func dispose() | |
func addToDisposablesBag(bag: DisposablesBag) | |
} | |
extension Disposable { | |
func addToDisposablesBag(bag: DisposablesBag) { | |
bag.add(self) | |
} | |
} |
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
// | |
// Promise.swift | |
// PiGuardMobile | |
// | |
// Created by Stefano Vettor on 06/04/16. | |
// Copyright © 2016 Stefano Vettor. All rights reserved. | |
// | |
import Foundation |
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
import Foundation | |
extension String { | |
func substringWithRange(r: Range<Int>) -> String { | |
return substringWithRange(Range(start: startIndex.advancedBy(r.startIndex), end: startIndex.advancedBy(r.endIndex))) | |
} | |
func substringToIndex(i: Int) -> String { | |
return substringToIndex(startIndex.advancedBy(i)) |
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
protocol HasName { | |
var name: String { get } | |
} | |
protocol HasSubNodes: HasName { | |
var subNodes: [HasName] { get } | |
} | |
protocol HasData: HasName { |