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
| import std.stdio, std.string, std.json, std.net.curl, std.conv; | |
| const string URL = "http://api.openweathermap.org/data/2.5/weather"; | |
| const string APPID = "TYPE YOUR APPID HERE"; | |
| void main(string[] args) { | |
| if (args.length != 2) { | |
| writeln("The arguments are too less or too much"); | |
| return; | |
| } |
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
| Inductive major (A B C:Prop) : Prop := | |
| | ab: A->B->major A B C | |
| | bc: B->C->major A B C | |
| | ca: C->A->major A B C. | |
| Theorem majmaj: | |
| forall A B C: Prop, | |
| major A B C -> ~major (~A) (~B) (~C). | |
| Proof. | |
| unfold not. |
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
| import Foundation | |
| class BenchTime { | |
| private var elapsedTime_: Double = 0 | |
| init(block: () -> ()) { | |
| let start = Date() | |
| block() | |
| elapsedTime_ = Date().timeIntervalSince(start) | |
| } | |
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
| import Foundation | |
| class GCDSolver { | |
| static func solve(_ a: Int, _ b: Int) -> Int { | |
| if a == 0 || b == 0 { | |
| fatalError("Fount zero value in the arguments") | |
| } | |
| var i = a, j = b | |
| if i < j { |
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
| import Foundation | |
| class EuclidSolver { | |
| static func solveGCD(_ a: Int, _ b: Int) -> Int { | |
| if a == 0 || b == 0 { | |
| fatalError("Fount zero value in the arguments") | |
| } | |
| var i = a, j = b | |
| if i < j { |
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
| import std.stdio, std.net.curl, std.file, std.windows.charset, std.conv, std.regex; | |
| void main() | |
| { | |
| auto content = get("yahoo.co.jp"); | |
| writeln(to!(string)(toMBSz(content))); | |
| auto r = ctRegex!("\\<img.*?src\\s*?=\\s*?[\"|\'](.*?(png|jpeg|jpg|gif))[\"|\'].*?\\>"); | |
| foreach(c; matchAll(content, r)) | |
| { | |
| writeln(to!(string)(toMBSz(c[1]))); |
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
| public class MonteCarlo { | |
| static public final long POINT_AMOUNT = 10000; | |
| public static void main(String[] args) { | |
| long count = 0; | |
| for (long i = 0; i <= POINT_AMOUNT; i++) { | |
| Point p = new Point(Math.random(), Math.random()); | |
| if(p.isInCircle()) count++; | |
| } | |
| System.out.println((double)4*(double)count / (double)POINT_AMOUNT); |
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
| import std.stdio; | |
| import std.json; | |
| import std.net.curl; | |
| import std.conv; | |
| import std.regex; | |
| import std.file; | |
| import std.string; | |
| import std.algorithm; | |
| import std.parallelism: parallel; | |
| import std.range; |
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
| import std.stdio; | |
| import std.conv; | |
| import std.range; | |
| import std.bigint; | |
| import std.datetime; | |
| import std.math; | |
| import std.algorithm; | |
| import std.datetime.stopwatch: benchmark, StopWatch; | |
| void main(string[] args) |
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
| import std.stdio; | |
| import std.range; | |
| import std.conv; | |
| import std.algorithm; | |
| void main() | |
| { | |
| iota(1, 100).map!(x => x % 15 == 0 ? "FizzBuzz": x % 3 == 0 ? "Fizz": x % 5 == 0 ? "Buzz": x.to!string).each!writeln; | |
| } |
OlderNewer