Python の型ヒントを使ったコードの例をいくつか用意しました。
各コードスニペットの一行目の https://mypy-play.net/?gist=... のようなリンクをクリックすると、mypy Playground でサンプルコードの型検査ができます。
それぞれの例のどこに型エラーがあるでしょうか?
python3 server.py| #include <inttypes.h> | |
| #include <mach/mach_time.h> | |
| #include <stdio.h> | |
| int main(void) { | |
| static mach_timebase_info_data_t timebase; | |
| mach_timebase_info(&timebase); | |
| uint64_t time = mach_absolute_time(); | |
| printf("mach_absolute_time: %" PRIu64 "\n", time); | |
| printf("resolution: %f\n", (double)timebase.numer / (double)timebase.denom); |
| #!/usr/bin/env python3 | |
| import json | |
| import sys | |
| def main(new_filename, old_filename): | |
| with open(old_filename) as f: | |
| old_images = json.load(f) | |
| with open(new_filename) as f: | |
| new_images = json.load(f) |
| type id = string | |
| module Environment = Map.Make ( | |
| struct | |
| type t = id | |
| let compare (x : id) y = compare x y | |
| end | |
| ) | |
| type value = |
I hereby claim:
To claim this, I am signing this object:
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Example of Proper Tail Calls</title> | |
| </head> | |
| <body> | |
| <h1>Example of Proper Tail Calls</h1> | |
| <p> | |
| Please open console. If your web browser supports proper tail calls, it shows "It works!". |
| int sum(int n) { | |
| int acc = 0; | |
| for (int i = 0; i <= n; i++) { | |
| acc += i; | |
| } | |
| return acc; | |
| } |
| #include <stdio.h> | |
| #define N 1024 | |
| int main(void) { | |
| int a[N][N]; | |
| int b[N][N]; | |
| int c[N][N]; | |
| for (int i = 0; i < N; i++) { |
This is an unofficial fork of OchaCaml for Homebrew Formula.
git diff