This file contains hidden or 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
| // | |
| // TCOTests.swift | |
| // Playground | |
| // | |
| // Created by kori on 4/20/16. | |
| // Copyright © 2016 hiroshi.kori. All rights reserved. | |
| // | |
| import XCTest |
This file contains hidden or 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
| -- Beautiful fibonacci implementation | |
| fibs = 0 : 1 : zipWith (+) fibs (tail fibs) |
This file contains hidden or 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
| // | |
| // LazyStreamTests.swift | |
| // Playground | |
| // | |
| // Created by kori on 4/20/16. | |
| // Copyright © 2016 hiroshi.kori. All rights reserved. | |
| // | |
| import Foundation |
This file contains hidden or 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 UIKit | |
| // https://www.facebook.com/video.php?v=10152735777427200&set=vb.9445547199&type=2&theater | |
| var str = "Hello, playground" | |
| func getNearbyChars(ch: String) -> Set<String> { | |
| switch ch { | |
| case "g": return Set(["g","h","f"]) |
This file contains hidden or 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
| // http://cpp.sh | |
| // Example program | |
| #include <iostream> | |
| #include <algorithm> // max,min | |
| #include <vector> | |
| #include <string> | |
| #include <sstream> | |
| #include <map> | |
| #include <iostream> |
This file contains hidden or 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 OptionalType { | |
| associatedtype W | |
| var optional: W? { get } | |
| } | |
| extension Optional: OptionalType { | |
| typealias W = Wrapped | |
| var optional: W? { return self } | |
| } |
This file contains hidden or 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
| #include <vector> | |
| #include <string> | |
| using namespace std; | |
| // repetition | |
| #define FOR(i,a,b) for(int i=(a);i<(b);++i) | |
| #define REP(i,n) for(int i=0;i<(n);++i) | |
| #define FORR(x,arr) for(auto& x:arr) | |
| #define SZ(a) int((a).size()) |
This file contains hidden or 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
| #include <iostream> | |
| #include <algorithm> | |
| #include <vector> | |
| #include <string> | |
| #include <sstream> | |
| #include <set> | |
| #include <map> | |
| #include <iostream> | |
| #include <utility> | |
| #include <cctype> |
This file contains hidden or 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
| // type alias | |
| typedef long long LL; | |
| typedef pair< int , int > II; | |
| typedef tuple< int, int, int > III; | |
| typedef vector<int> VI; | |
| typedef vector<string> VS; | |
| typedef vector<vector<int>> VVI; | |
| typedef unordered_map<int,int> MAPII; | |
| typedef unordered_set<int> SETI; | |
| template<class T> using VV=vector<vector<T>>; |
This file contains hidden or 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
| #define FOR(i,a,b) for(int i=(a);i<(b);++i) | |
| #define REP(i,n) for(int i=0;i<(n);++i) | |
| #define FORE(i,a,b) for(int i=(a);i<=(b);++i) | |
| #define REPE(i,n) for(int i=0;i<=(n);++i) | |
| #define FORR(x,arr) for(auto& x:arr) | |
| #define SZ(a) int((a).size()) | |
| #define ALL(c) (c).begin(),(c).end() | |
| typedef long long LL; | |
| typedef pair< int , int > II; | |
| typedef unordered_map < int, int > MAPII; |