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
/* | |
k近傍法のプログラム | |
gcc k-nearest.c -lm でコンパイル | |
下に書いてあるアドレスからwine.dataをダウンロードして同じファイル内で使って下さい | |
a.out の引数にはKの値と、正規化するかどうか(0 or 1)の2つの引数を入力します。 | |
k-nearest neighbor algorithm for wine.data in ( http://archive.ics.uci.edu/ml/machine-learning-databases/wine/ ) | |
how to compile : |
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 datetime | |
import tweepy | |
import urllib | |
import time | |
import os | |
from BeautifulSoup import BeautifulSoup | |
consumer_key="" | |
consumer_secret="" |
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
(* | |
使い方: | |
ocamlをインストールする。apt-getで簡単にインストール可能。 | |
以下のコマンドでコンパイルする。 | |
ocamlc -o snake_checker str.cma snake_checker.ml | |
*) | |
module Mylib = struct | |
(* | |
mylib requires Str module. In windows, -I option is required like a following command, |
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
(* | |
- To compile, type following | |
ocamlopt str.cmxa graphics.cmxa nearest.ml | |
*) | |
module Mylib = struct | |
let valof = function | |
| None -> failwith "valof" | |
| Some x -> x | |
let get_matrix arr x y = |
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
{Cmt_format.cmt_modname = "One_level_prob"; | |
cmt_annots = | |
Cmt_format.Implementation | |
{Typedtree.str_items = | |
[{Typedtree.str_desc = | |
Typedtree.Tstr_value (Asttypes.Nonrecursive, | |
[({Typedtree.pat_desc = | |
Typedtree.Tpat_var ({Ident.stamp = 1008; name = "f"; flags = 0}, | |
{Asttypes.txt = "f"; | |
loc = |
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
utop[53]> Cmt_format.read_cmt "/home/tokuda/ocaml/cmt_test/s_question.cmt";; | |
- : Cmt_format.cmt_infos = | |
{Cmt_format.cmt_modname = "S_question"; | |
cmt_annots = | |
Cmt_format.Implementation | |
{Typedtree.str_items = | |
[{Typedtree.str_desc = | |
Typedtree.Tstr_value (Asttypes.Nonrecursive, | |
[({Typedtree.pat_desc = | |
Typedtree.Tpat_var ({Ident.stamp = 1008; name = "f"; flags = 0}, |
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
(* variable.ml | |
let f = fun x -> x | |
let g = f | |
*) | |
utop[0]> Cmt_format.read_cmt "/home/tokuda/ocaml/cmt_test/variable.cmt";; | |
- : Cmt_format.cmt_infos = | |
{Cmt_format.cmt_modname = "Variable"; | |
cmt_annots = |
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
let f x = | |
let g y = x::[] in | |
let k = fun e -> g in | |
k | |
utop[7]> Cmt_format.read_cmt "/home/tokuda/ocaml/cmt_test/final_case.cmt";; | |
- : Cmt_format.cmt_infos = | |
{Cmt_format.cmt_modname = "Final_case"; | |
cmt_annots = |
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
(* これは通らない *) | |
let f x = | |
let (g:'a) = fun y -> y | |
g 1; g "str" | |
(* これは通る *) | |
let f x = | |
let g = fun y -> y | |
g 1; g "str" |
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
fun f x = let ... x :: nil ... | |
... Array.update(a, i, x) ... | |
in (x, x) end | |
fun g y = f (y, 3.14) | |
(* f : 'a -> 'a * 'a *) | |
(* g : 'b -> (b * real) * ('b * real) *) |
OlderNewer