2008-03-01ãã1ã¶æéã®è¨äºä¸è¦§
ãã£ãï¼ãããã£ãï¼ï¼ãã³ã¹ã¯ãªããã§ããã¾ã§ã§ããã®ãï¼å¾ã§ã½ã¼ã¹ãèªãã§ã¿ããã åã£ãï¼ï¼ ä»ã®äººã®ã³ã¡ã³ããå ¥ãã¨ãªã»ããããããããã®ã§ã人ãããªãæé帯ã«ããã¨ããã¿ããã§ãã ãã¨ãã³ã¡ã³ãããã¨ãã¯ä¸æåæ¢ããã¨æéãé²ã¾ãªãâ¦
ã³ã³ãã¤ã«ã®ããæ¹ã¨ãããã¡ã³ã¯ã¿ã¼ã¨ãããªãã¸ã§ã¯ãã¨ããã©ãã«ä»ãå¼æ°ã¨ãããªãã·ã§ã³å¼æ°ã¨ããå¤ç¸ã´ã¡ãªã¢ã³ãã¨ããããããã£ããã©ãå ¨é¨ãã£é£ã°ãã¦ãããªãGUIã ãéãé ãããå¼ãåºãããããç°¡åãªããã°ã©ã ã open Tk open Printf â¦
ã¡ã«ãªPã®æè¿ã®2ä½ã«ããããï¼æ·±å¤çªçµã£ã½ãããªã好ãã ãã æ¥é¦ã³ãã¥ã®ç©ºç½ã®æ°æéãæ¤è¨¼ãã¦ã¿ãããã ãã ã«ãªã£ã â ãã³ãã³åç»:Q èªçæ¥ãè¿ãã®ã§ãããæ¥é¦ããã®é åãããããããåç» â ãã³ãã³åç»:Q ãã¤ãªã¹ã æ¯åº¦ããªãã¿æµæµªã®Pãâ¦
let version="0.1" let display_width = ref 80 let filenames = ref [] let spec = [("--width", Arg.Int (fun w -> display_width := w), "Set width of lines"); ("-version", Arg.Unit (fun () -> Printf.printf "fold in OCaml ver: %s\n" version), "Dâ¦
é«æ§»ããããICå®æå¸ã®ã¿ããã®ä»æ¹ãæãã¦ããã¾ãã â ãã³ãã³åç»:Q ãã ããã¼ï½ï½ï½è¿½è¨ã æ¹è¯çãã¦ãã ã¼ ãç¶ãé«æ§»ããããICå®æå¸ã®ã¿ããã®ä»æ¹ãæãã¦ããã¾ãã â ãã³ãã³åç»:Q
let version = "0.1" let display_byte_count = ref false let display_line_count = ref false let display_word_count = ref false let filenames = ref [] let spec = [("-c", Arg.Set display_byte_count, "Display the byte counts."); ("-l", Arg.Set â¦
ãããã¾ãç°¡åã«å®è£ ã§ããã å ¥åºåé¢ä¿ã¯ç´ ç´ã«æ¸ããã¨ããã¨ãã£ã±ãæç¶ãåè¨èªã¿ããã«ãªã£ã¡ããã®ããªã let version = "0.1" let display_linenum = ref false let filenames = ref [] let spec = [("-n", Arg.Set display_linenum, "Display linâ¦
ã¡ãã£ã¨è¨ç®ããããããç°¡åãªå¼ã«ãªã£ãã ãããåºã«åå®è£ ã open Num let pi length = let min = Int 1 // Int 10 **/ Int length in let zero = Int 0 and one = Int 1 and two = Int 2 and three = Int 3 and four = Int 4 in let rec sum n an x = â¦
ãªãã¨ãªããããããªã£ããããã£ã¦ã¿ãã æå¤ã¨ç´ ç´ã«ãã£ããæ¸ããããã£ã±ãæçæ°åãããã¨ããããã®æ¥½ã ãªãã 使ã£ãã¢ã«ã´ãªãºã ã¯ãåå¨ç - Wikipediaã§è¦ã¤ãããã®å¼ã arcsin(x)ã®x=1/2ã«ããããã¤ã©ã¼å±éã§ãåæãéãããããã¸ãã¼ãâ¦
ãã³ãã³åç»é¢é£ã®ã¹ã¬ãã¿ãã«ãæå¤ã¨çããç¥ããªããããªã®ã§æ¸ãã¦ã¿ã¾ãã åç»åçç»é¢ã§ã¯F5ã§æ´æ°ã§ããªããã©ãCtrl+Rãªãã§ãããï¼
ã·ã°ããã£ã®å®ç¾© # module type QUEUE = sig type 'a t exception Empty val empty: 'a t val add: 'a t -> 'a -> 'a t val take: 'a t -> 'a * 'a t val peek: 'a t -> 'a end;; module type QUEUE = sig type 'a t exception Empty val empty : 'a t val â¦
# module type TABLE = sig type ('a, 'b) t val empty : ('a, 'b) t val add : 'a -> 'b -> ('a, 'b) t -> ('a, 'b) t val retrieve : 'a -> ('a, 'b) t -> 'b option val dump : ('a, 'b) t -> ('a * 'b) list end;; module type TABLE = sig type ('a, 'bâ¦
# open Num;; # (* f'(x)ãæ±ãã *) let deriv f = let dx = Int 10 **/ Int (-50) in fun x -> (f (x +/ dx) -/ f x) // dx;; val deriv : (Num.num -> Num.num) -> Num.num -> Num.num = <fun> # (* f(x), f(f(x)), f(f(f(x))), ..., ãè¨ç®ãã¦ãããã¹ããã</fun>â¦
ãã¤ãã®å¦ãã¾ãã¯åã®å®ç¾©ã # type 'a mlist = MNil | MCons of 'a * 'a mlist ref;; type 'a mlist = MNil | MCons of 'a * 'a mlist ref # type 'a queue = {mutable head : 'a mlist; mutable tail : 'a mlist};; type 'a queue = { mutable head : 'aâ¦
# type 'a seq = Cons of 'a * (unit -> 'a seq);; type 'a seq = Cons of 'a * (unit -> 'a seq) # let rec from n = Cons (n, fun () -> from (n+1));; val from : int -> int seq = <fun> # let rec take n (Cons (x, f)) = if n > 0 then x :: take (n-1) (f </fun>â¦
# let rec prime_seq primes x = let x' = x + 1 in let rec is_prime n = function [] -> true | p :: rest -> p*p <= x' && n mod p <> 0 && is_prime n rest in if is_prime x' primes then Cons (x', prime_seq (x' :: primes)) else prime_seq primes xâ¦
æ´æ°ã®ç¡éæ°åã®ã¸ã§ãã¬ã¼ã¿ã¿ãããªãã®ã # type intseq= Cons of int * (int -> intseq);; type intseq = Cons of int * (int -> intseq) ãã£ããããæ°åã®ã¸ã§ãã¬ã¼ã¿ # let fib = let rec f x y = Cons (x, f (x+y)) in Cons (1, f 1);; å®éã«è¨â¦
ã¾ãã¯åã®å®ç¾©ã # type arith = Const of int | Add of arith * arith | Mul of arith * arith;; type arith = Const of int | Add of arith * arith | Mul of arith * arith å¼ãè©ä¾¡ããé¢æ°ã»æååã«å¤æããé¢æ°ã»å±éããé¢æ° # let rec eval = funcâ¦
å¼ãç¶ãç·´ç¿åé¡ã # type token = PCDATA of string | Open of string | Close of string;; type token = PCDATA of string | Open of string | Close of string # type ('a, 'b) xml = XLf of 'b option | XBr of 'a * ('a, 'b) xml list;; type ('a, 'b)â¦
æ¨æ§é ã®å®ç¾© # type 'a tree = Lf | Br of 'a * 'a tree * 'a tree;; type 'a tree = Lf | Br of 'a * 'a tree * 'a tree # type 'a rosetree = RLf | RBr of 'a * 'a rosetree list;; type 'a rosetree = RLf | RBr of 'a * 'a rosetree list # let rtree â¦
ãã£ãããã¼ã¿åãå®ç¾©ã大ããã¨æ·±ããæ±ããé¢æ°ãå®ç¾©ã # type 'a tree = Lf | Br of 'a * 'a tree * 'a tree;; type 'a tree = Lf | Br of 'a * 'a tree * 'a tree # let rec size = function Lf -> 0 | Br (_, left, right) -> 1 + size left + size â¦
ããã«å¼ãç¶ãOCamlåå¼·ä¸ããã®æ¬ã使ã£ã¦åå¼·ãã¦ãã¾ãã ããã°ã©ãã³ã° in OCaml ~é¢æ°åããã°ã©ãã³ã°ã®åºç¤ããGUIæ§ç¯ã¾ã§~ä½è : äºååµæ·³åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾çºå£²æ¥: 2007/11/29ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼è³¼å ¥: 11人 ã¯ãªãã¯: 16â¦
ç·´ç¿åé¡ã解ãããçµæ§é·ãã³ã¼ãã«ãªã£ãããã£ãããªã®ã§ãè¨å¿µã«ãã³ã ä½ã£ã¦æºè¶³ãã¦ãã¾ã£ããåä½ç¢ºèªã¯ã¾ãä»åº¦ã (* å³å½¢ãå®ç¾© *) type figure = Point | Circle of float | Rectangle of float * float | Square of float;; (* 座æ¨æ å ±ããã£ãâ¦
èªç¶æ°rã«ã¤ãã¦ãx*x + y * y = rãæºããèªç¶æ°(x, y)ã®ãªã¹ããè¿ãé¢æ° ãã ããx ⧠y ⧠0 # let squares r = let isqrt n = int_of_float (sqrt (float_of_int n)) in let y_max = isqrt (r / 2) in let rec get_list y list = if y >= y_max then listâ¦
OCamlåå¼·ä¸ãKã³ã³ããã¼ã¿ã¨Sã³ã³ããã¼ã¿ãåºã¦ããã OCamlã§funå¼ã¨é¢æ°é©ç¨ã®çµã¿åãããã®ã¿ãã§è¡¨ç¾ã§ããé¢æ°ã¯Sã¨Kã®ãé¢æ°é©ç¨ã§çµã¿åããããã¨ã§ãã¹ã¦è¡¨ç¾ã§ãããã¨ãç¥ããã¦ãã¾ãã # let s x y z = x z (y z);; val s : ('a -> 'b -> 'â¦
H.264ã60fpsã®åç»ãFirefoxã§è¦ããã«ã¯ã«ã¯ãã¦ããIEã§è¦ãããã«ãã«ã ã£ãã ããã¯ãæ¡å¼µå ¥ããããã®ãæªãã®ã ããããããã¨ããFirefoxåãã®Flashãã©ã°ã¤ã³ãã·ã§ãããã ãããã Operaãåããã©ã°ã¤ã³å ¥ã£ã¦ãããããã©ããã«ãã«ã ã£ãã â¦
ãã³ãã³åç»ãã¯ã¦ãªã«è²¼ããããã«ãªã£ãããããã ãã©æ®å¿µãªããä»ã¯ã¡ã³ããã³ã¹ä¸ããã¤ãªã¹ãã«ç»é²ãããæ°ã«å ¥ãåç»ãè²¼ãã¾ããã ãããããªããããã¨ããããå¯ä¸smçªå·ãè¦ãã¦ãã¾ã£ãåç»ãè²¼ã£ã¦ããã¾ãã
èªåããã®å ´ã§ç解ãããã¨ã®ã¡ã¢ã§ããããå¤å°èª¤è§£ãã¦ããç¹ãããããããã¾ãããæ£ããæ å ±ã¯ãã¡ãã§ããã³ãã³åç»ãããSP1ãã«ãã¼ã¸ã§ã³ã¢ãã ãã ã¼ãã¼ã¡ã¼ã«ã¼ãç¡åé å¸ - ITmedia ãã¥ã¼ã¹ éæ¼å 12æ15ååä»éå§ãéä¼13æãèªåã¯12æâ¦
ãããããåçç»é¢ã«ããã¾ã¾æ¾ç½®ãã¦ããã¨ãæå ±ã®æéã«ãªã£ã¦ãæå ±ãé³´ãã¾ããã2ã3æéãããåããæ¾ç½®ãã¦ããã¨ããããã§ããè¤æ°ã¿ãéããç¶æ ã§ãæå ±ãã¨ã³ã¼ã«ãªããªãã£ãã®ã§æ°ã¥ãã¾ãããã¾ããæå ±ãã£ã³ã»ã«æã¨ãã¦ã¯å ¨ç¶å®ç¨çãâ¦