2
|
|
- としはる あんさい
- 7 years ago
- Views:
Transcription
1
2 2
3 MapReduce 3
4 4
5 5
6 6
7 Functional Functional Programming 7
8 8
9 9
10 10
11 11
12 12
13 13
14 [10, 20, 30, 40, 50] 0 n n 10 * * * * *4 =
15 10 * * * * *4 = 400 for 15
16 for Douglas Crockford JavaScript: for JavaScript C JavaScript C Java Lisp Scheme 16
17 for 17
18 for for for for for ) for two days for (i = 0; i < N; i++) { } 0 N = (N - 1) = N 1/3 + 1/3 + 1/3 1 18
19 JavaScript for function func(ar) { var ret = 0; for (var i=0; i < ar.length; i++) { ret = ret + ar[i]*i; } return ret; } func([10,20,30,40,50]);
20 Haskell MapReduce zip [0..] [10,20,30,40,50] [(0,10),(1,20),(2,30),(3,40),(4,50)] map (\(i,x) -> x*i) [0,20,60,120,200] foldl (+) 0 ((((0 + 0) + 20) + 60) + 120) func = foldl (+) 0. map (\(i,x) -> x*i). zip [0..] func [10,20,30,40,50]
21 21
22 22
23 23
24 head (car, first) tail (cdr, rest) : (cons) 24
25 25
26 -- [1,2,3] -- 1 : 2 : 3 : [] : (cons) -- 1 : (2 : (3 : [])) : a : [ b, o, a, r, d ] [ a, b, o, a, r, d ] head tail sum [] = 0 sum (x:xs) = x + sum xs 26
27 (1) ++ (append) zs = xs ++ ys ++ 1) 27
28 (2) ++ O(N) xs ++ (ys ++ zs) ++ O(N^2) (xs ++ ys) ++ zs ++ 2) 28
29 29
30 30
31 factorial(0) = 1 factorial(n) = n * factorial(n - 1) factorial :: Int -> Int -- factorial 0 = 1 -- factorial n = n * factorial (n-1) 31
32 (C) nobsun 1) factorial n n! 2) factorial (n - 1) 3) n factorial n = n * factorial (n-1) 32
33 length :: [Int] -> Int length [] = 0 length (x:xs) = 1 + length xs 33
34 ( ) 34
35 ( ) Haskell = (++) :: [a] -> [a] -> [a] [] ++ ys = ys (x:xs) ++ ys = x : (xs ++ ys) {- (++) (x:xs) ys = (:) x (xs ++ ys) -} delay force 35
36 ( ) sum :: Num a => [a] -> a sum [] = 0 sum (x:xs) = x + sum xs {- sum (x:xs) = (+) x (sum xs) -} sum [1,2,3,4] = 1 + sum [2,3,4] = 1 + (2 + sum [3,4]) = 1 + (2 + (3 + sum [4])) = 1 + (2 + (3 + (4 + sum []))) = 1 + (2 + (3 + (4 + 0))) 36
37 sum :: Num a => [a] -> a sum xs = sum 0 xs where sum r [] = r sum r (y:ys) = sum (y+r) ys sum 0 [1,2,3,4] = sum 1 [2,3,4] = sum 3 [3,4] = sum 6 [4] = sum 10 [] = 10 37
38 38
39 MapReduce 39
40 [1,2,3,4] 1 + (2 + (3 + (4 + 0))) [1,2,3,4] (((0 + 1) + 2) + 3)
41 foldr foldr :: (a -> b -> b) -> b -> [a] -> b foldr _ ini [] = ini foldr op ini (x:xs) = op x (foldr op ini xs) ( ) ++ foldr (++) :: [a] -> [a] -> [a] xs ++ ys = foldr (:) ys xs 41
42 foldl foldl :: (a -> b -> a) -> a -> [b] -> a foldl _ acc [] = acc foldl op acc (x:xs) = foldl op (op acc x) xs sum foldl sum :: Num a => [a] -> a sum xs = foldl (+) 0 xs 42
43 map map :: (a -> b) -> [a] -> [b] map _ [] = [] map f (x:xs) = f x : map f xs foldr map :: (a -> b) -> [a] -> [b] map f xs = foldr (\y ys -> f y:ys) [] xs 43
44 filter filter :: (a -> Bool) -> [a] -> [a] filter _ [] = [] filter prd (x:xs) prd x = x : filter prd xs otherwise = filter pred xs foldr filter :: (a -> Bool) -> [a] -> [a] filter prd xs = foldr filter [] xs where filter y ys prd y = y : ys otherwise = ys 44
45 45
46 sumeven :: [Int] -> Int sumeven xs = sumeven xs 0 where sumeven [] r = r sumeven (y:ys) r even y = sumeven ys (y + r) otherwise = sumeven ys r MapReduce sumeven :: [Int] -> Int sumeven xs = foldl (+) 0 (filter even xs) {- sumeven = foldl (+) 0. filter even -} 46
47 47
48 48
49 "String" = [ S, t, r, i, n, g ] 49
50 "Subject: Hello world " key = "Subject" val = "Hello world" 50
51 JavaScript var target = "Subject: Hello world "; var x = target.match(/^(\w+):\s*(.*)/); var key = x[1]; var val = x[2].replace(/\s*$/,""); 51
52 target = "Subject: Hello world " break (== : ) target ("Subject", ": Hello world ") tail (snd ) " Hello world " dropwhile isspace "Hello world " dropwhileend isspace "Hello world" 52
53 break :: (a -> Bool) -> [a] -> ([a],[a]) break _ [] = ([],[]) break p (x:xs) p x = ([],x:xs) otherwise = (x:ys,zs) where (ys,zs) = break p xs dropwhile :: (a -> Bool) -> [a] -> [a] dropwhile _ [] = [] dropwhile p (x:xs) p x = dropwhile p xs otherwise = x:xs dropwhileend :: (a -> Bool) -> [a] -> [a] dropwhileend p = foldr op [] where op x xs p x && null xs = [] otherwise = x:xs 53
54 Ask not what your country can do for you, but what you can do for your country. "can do for you" 54
55 ( ) tails tails "banana" ["banana","anana","nana","ana","na","a",""] tails tails :: [a] -> [[a]] tails [] = [[]] tails xs = xs : tails (tail xs) 55
56 (1) tails "mississippi" ["mississippi","ississippi", "ssissippi","sissippi",... sort ["","i","ippi","issippi", "ississippi","mississippi","pi",... zip (tail ) [("","i"),("i","ippi"), ("ippi","issippi"), ("issippi","ississippi"),... 56
57 (2) comlen :: Eq a => [a] -> [a] -> Int comlen as bs = comlen as bs 0 where comlen (x:xs) (y:ys) n x == y = comlen xs ys (n+1) comlen n = n lenstr :: Eq a => ([a], [a]) -> (Int,[a]) lenstr (xs,ys) = (len,xs) where len = comlen xs ys 57
58 (3) [("","i"),("i","ippi"), ("ippi","issippi"), ("issippi","ississippi"),... map lenstr [(0,""),(1,"i"),(1,"ippi"), (4,"issippi"),(0,"ississippi"),... maximumby (comparing fst) (4,"issippi") take (fst ) (snd ) "issi" 58
59 59
60 60
61 data List a = Nil Cons a (List a) data Tree a = Tip Bin a (Tree a) (Tree a) 61
62 10,
63 (1) preorder :: Tree a -> [a] preorder Tip = [] preorder (Bin x l r) = [x] ++ preorder l ++ preorder r inorder :: Tree a -> [a] inorder Tip = [] inorder (Bin x l r) = inorder l ++ [x] ++ inorder r postorder :: Tree a -> [a] postorder Tip = [] postorder (Bin x l r) = postorder l ++ postorder r ++ [x] 63
64 (2) preorder :: Tree a -> [a] preorder t = go t [] where go Tip xs = xs go (Bin x l r) xs = x : (go l (go r xs)) inorder :: Tree a -> [a] inorder t = go t [] where go Tip xs = xs go (Bin x l r) xs = go l (x : (go r xs)) postorder :: Tree a -> [a] postorder t = go t [] where go Tip xs = xs go (Bin x l r) xs = go l (go r (x : xs)) 64
65 65
66 66
67 O(1) Finite Map ( ) 67
68 68
69 69
70 = DSL data Parser a = Parser (String -> (Maybe a, String)) char :: Char -> Parser Char char c =... (< >) :: Parser a -> Parser a -> Parser a p1 < > p2 =... 70
71 JSON BNF (RFC 4627) value = object / array / number / string... JSON value :: Parser JSON value = jsobject < > jsarray < > jsnumber < > jsstring... BNF ( ) 71
72 72
73 73
74 7 7 Scala Erlang Clojure Haskell Scheme Haskell Scala OCaml Purely Functional Data Structure Haskell ( ) 74
org/ghc/ Windows Linux RPM 3.2 GHCi GHC gcc javac ghc GHCi(ghci) GHCi Prelude> GHCi :load file :l file :also file :a file :reload :r :type expr :t exp
3 Haskell Haskell Haskell 1. 2. 3. 4. 5. 1. 2. 3. 4. 5. 6. C Java 3.1 Haskell Haskell GHC (Glasgow Haskell Compiler 1 ) GHC Haskell GHC http://www.haskell. 1 Guarded Horn Clauses III - 1 org/ghc/ Windows
More informationCopyright c 2006 Zhenjiang Hu, All Right Reserved.
1 2006 Copyright c 2006 Zhenjiang Hu, All Right Reserved. 2 ( ) 3 (T 1, T 2 ) T 1 T 2 (17.3, 3) :: (Float, Int) (3, 6) :: (Int, Int) (True, (+)) :: (Bool, Int Int Int) 4 (, ) (, ) :: a b (a, b) (,) x y
More informationhaskell.gby
Haskell 1 2 3 Haskell ( ) 4 Haskell Lisper 5 Haskell = Haskell 6 Haskell Haskell... 7 qsort [8,2,5,1] [1,2,5,8] "Hello, " ++ "world!" "Hello, world!" 1 + 2 div 8 2 (+) 1 2 8 div 2 3 4 map even [1,2,3,4]
More informationpresen.gby
kazu@iij.ad.jp 1 2 Paul Graham 3 Andrew Hunt and David Thomas 4 5 Java 6 Java Java Java 3 7 Haskell Scala Scala 8 9 Java Java Dean Wampler AWT ActionListener public interface ActionListener extends EventListener
More informationFunctional Programming
PROGRAMMING IN HASKELL プログラミング Haskell Chapter 7 - Higher-Order Functions 高階関数 愛知県立大学情報科学部計算機言語論 ( 山本晋一郎 大久保弘崇 2013 年 ) 講義資料オリジナルは http://www.cs.nott.ac.uk/~gmh/book.html を参照のこと 0 Introduction カリー化により
More information3 3.1 algebraic datatype data k = 1 1,1... 1,n1 2 2,1... 2,n2... m m,1... m,nm 1 m m m,1,..., m,nm m 1, 2,..., k 1 data Foo x y = Alice x [y] B
3 3.1 algebraic datatype data 1 2... k = 1 1,1... 1,n1 2 2,1... 2,n2... m m,1... m,nm 1 m m m,1,..., m,nm m 1, 2,..., k 1 data Foo x y = Alice x [y] Bob String y Charlie Foo Double Integer Alice 3.14 [1,2],
More information2
Haskell ( ) kazu@iij.ad.jp 1 2 Blub Paul Graham http://practical-scheme.net/trans/beating-the-averages-j.html Blub Blub Blub Blub 3 Haskell Sebastian Sylvan http://www.haskell.org/haskellwiki/why_haskell_matters...
More informationfp.gby
1 1 2 2 3 2 4 5 6 7 8 9 10 11 Haskell 12 13 Haskell 14 15 ( ) 16 ) 30 17 static 18 (IORef) 19 20 OK NG 21 Haskell (+) :: Num a => a -> a -> a sort :: Ord a => [a] -> [a] delete :: Eq a => a -> [a] -> [a]
More informationkyoto.gby
Haskell 2013.5.24 1 2 1988 B4 Sun 1992 3 Unix Magazine Unix Magazine UNIX RFC FYI (For Your Information) 4 IP PEM (Privacy Enhanced Mail) WIDE Project mh-e PEM 5 6 Unix Magazine PGP PGP 1 7 Mew (MIME)
More informationParametric Polymorphism
ML 2 2011/04/19 Parametric Polymorphism Type Polymorphism ? : val hd_int : int list - > int val hd_bool : bool list - > bool val hd_i_x_b : (int * bool) list - > int * bool etc. let hd_int = function (x
More informationbdd.gby
Haskell Behavior Driven Development 2012.5.27 @kazu_yamamoto 1 Haskell 4 Mew Firemacs Mighty ghc-mod 2 Ruby/Java HackageDB 3 Haskeller 4 Haskeller 5 Q) Haskeller A) 6 7 Haskeller Haskell 8 9 10 Haskell
More information2011.12.3 1 2 Q) A) 3 Q) A) 4 5 6 Haskell 7 8 Parser data Parser a = Parser (String -> [(a,string)]) Parser pwrap :: a -> Parser a pwrap v = Parser $ \inp -> [(v,inp)] Parser pbind :: Parser a -> (a ->
More informationmonad.gby
2012.11.18 1 1 2 2 DSL 3 4 Q) A) 5 Q) A) 6 7 8 Haskell 9 10 Parser data Parser a = Parser (String -> [(a,string)]) Parser pwrap :: a -> Parser a pwrap v = Parser $ \inp -> [(v,inp)] Parser pbind :: Parser
More information連載 構文解析器結合子 山下伸夫 (( 株 ) タイムインターメディア ) 文字列の分解 1 1 Haskell lines Prelude lines :: String -> [String] lines "" = [] lines s = let (l,s'
連載 構文解析器結合子 山下伸夫 (( 株 ) タイムインターメディア ) nobsun@sampou.org 文字列の分解 1 1 Haskell lines Prelude lines :: String -> [String] lines "" = [] lines s = let (l,s') = break ('\n'==) s in l : case s' of [] -> [] (_:s'')
More information¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~alse
I Exercise on Programming I http://bit.ly/oitprog1 1, 2 of 14 ( RD S ) I 1, 2 of 14 1 / 44 Ruby Ruby ( RD S ) I 1, 2 of 14 2 / 44 7 5 9 2 9 3 3 2 6 5 1 3 2 5 6 4 7 8 4 5 2 7 9 6 4 7 1 3 ( RD S ) I 1, 2
More information# let st1 = {name = "Taro Yamada"; id = };; val st1 : student = {name="taro Yamada"; id=123456} { 1 = 1 ;...; n = n } # let string_of_student {n
II 6 / : 2001 11 21 (OCaml ) 1 (field) name id type # type student = {name : string; id : int};; type student = { name : string; id : int; } student {} type = { 1 : 1 ;...; n : n } { 1 = 1 ;...; n = n
More information第8回 関数
1 関数型プログラミング 第 8 回関数 萩野達也 hagino@sfc.keio.ac.jp 2 関数定義 square n = n * n 与えられた数の 2 乗を計算する square 関数を定義している. 変数 square に 2 乗を計算する関数を束縛 (bind) したい. a = 10 変数 a に定数 10 を束縛する. square =... 3 高階関数 関数も値の一つである.
More informationtest.gby
Beautiful Programming Language and Beautiful Testing 1 Haskeller Haskeller 2 Haskeller (Doctest QuickCheck ) github 3 Haskeller 4 Haskell Platform 2011.4.0.0 Glasgow Haskell Compiler + 23 19 8 5 10 5 Q)
More informationJacques Garrigue
Jacques Garrigue Garrigue 1 Garrigue 2 $ print_lines () > for i in $1; do > echo $i > done $ print_lines "a b c" a b c Garrigue 3 Emacs Lisp (defun print-lines (lines) (dolist (str lines) (insert str)
More information6-1
6-1 (data type) 6-2 6-3 ML, Haskell, Scala Lisp, Prolog (setq x 123) (+ x 456) (setq x "abc") (+ x 456) ; 6-4 ( ) subtype INDEX is INTEGER range -10..10; type DAY is (MON, TUE, WED, THU, FRI, SAT, SUN);
More informationjssst-ocaml.mgp
Objective Caml Jacques Garrigue Kyoto University garrigue@kurims.kyoto-u.ac.jp Objective Caml? 2 Objective Caml GC() Standard MLHaskell 3 OCaml () OCaml 5 let let x = 1 + 2 ;; val x : int = 3 ;; val-:
More information5 IO Haskell return (>>=) Haskell Haskell Haskell 5.1 Util Util (Util: Tiny Imperative Language) 1 UtilErr, UtilST, UtilCont, Haskell C
5 IO Haskell return (>>=) Haskell Haskell Haskell 5.1 Util Util (Util: Tiny Imperative Language) 1 UtilErr, UtilST, UtilCont,... 5.1.1 5.1.2 Haskell C LR ( ) 1 (recursive acronym) PHP, GNU V - 1 5.1.1
More information1. A0 A B A0 A : A1,...,A5 B : B1,...,B12 2. 5 3. 4. 5. A0 (1) A, B A B f K K A ϕ 1, ϕ 2 f ϕ 1 = f ϕ 2 ϕ 1 = ϕ 2 (2) N A 1, A 2, A 3,... N A n X N n X N, A n N n=1 1 A1 d (d 2) A (, k A k = O), A O. f
More informationMicrosoft PowerPoint - ProD0107.ppt
プログラミング D M 講義資料 教科書 :6 章 中田明夫 nakata@ist.osaka-u.ac.jp 2005/1/7 プログラミング D -M- 1 2005/1/7 プログラミング D -M- 2 リスト 1 リスト : 同じ型の値の並び val h=[10,6,7,8,~8,5,9]; val h = [10,6,7,8,~8,5,9]: int list val g=[1.0,4.5,
More information4 (induction) (mathematical induction) P P(0) P(x) P(x+1) n P(n) 4.1 (inductive definition) A A (basis ) ( ) A (induction step ) A A (closure ) A clos
4 (induction) (mathematical induction) P P(0) P(x) P(x+1) n P(n) 4.1 (inductive definition) A A (basis ) ( ) A (induction step ) A A (closure ) A closure 81 3 A 3 A x A x + A A ( A. ) 3 closure A N 1,
More information(CC Attribution) Lisp 2.1 (Gauche )
http://www.flickr.com/photos/dust/3603580129/ (CC Attribution) Lisp 2.1 (Gauche ) 2 2000EY-Office 3 4 Lisp 5 New York The lisps Sammy Tunis flickr lisp http://www.flickr.com/photos/dust/3603580129/ (CC
More information導入基礎演習.ppt
Multi-paradigm Programming Functional Programming Scheme Haskell ML Scala X10 KL1 Prolog Declarative Lang. C Procedural Lang. Java C++ Python Object-oriented Programming / (root) bin home lib 08 09
More informationCopyright c 2008 Zhenjiang Hu, All Right Reserved.
2008 10 27 Copyright c 2008 Zhenjiang Hu, All Right Reserved. (Bool) True False data Bool = False True Remark: not :: Bool Bool not False = True not True = False (Pattern matching) (Rewriting rules) not
More information/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1
I117 II I117 PROGRAMMING PRACTICE II 2 MEMORY MANAGEMENT 2 Research Center for Advanced Computing Infrastructure (RCACI) / Yasuhiro Ohara yasu@jaist.ac.jp / SCHEDULE 1. 2011/06/07(Tue) / Basic of Programming
More informationFunctional Programming
PROGRAMMING IN HASKELL プログラミング Haskell Chapter 10 - Declaring Types and Classes 型とクラスの定義 愛知県立大学情報科学部計算機言語論 ( 山本晋一郎 大久保弘崇 2011 年 ) 講義資料オリジナルは http://www.cs.nott.ac.uk/~gmh/book.html を参照のこと 0 型宣言 (Type Declarations)
More informationr3.dvi
2012 3 / Lisp(2) 2012.4.19 1 Lisp 1.1 Lisp Lisp (1) (setq) (2) (3) setq defun (defun (... &aux...)...) ( ) ( nil ) [1]> (defun sisoku (x y &aux wa sa sho seki) (setq wa (+ x y)) (setq sa (- x y)) (setq
More informationMicrosoft PowerPoint - IntroAlgDs-06-8.ppt
アルゴリズムとデータ構造入門 2006 年 11 月 21 日 アルゴリズムとデータ構造入門 2. データによる抽象の構築 2.2 階層データ構造と閉包性 奥乃博大学院情報学研究科知能情報学専攻知能メディア講座音声メディア分野 http://winnie.kuis.kyoto-u.ac.jp/~okuno/lecture/06/introalgds/ okuno@i.kyoto-u.ac.jp 12
More information0 1 1 @master q 3 1.1.......................................... 3 1.2....................................... 4 1.3....................................
1 0!? Q.? A. Q. B. Q.? A.! 2 10 6 Scheme 80! λ 81!? λ ( ) 82!? λ ( ) 83!? λ 4 3! λ 0 1 1 @master q 3 1.1.......................................... 3 1.2....................................... 4 1.3............................................
More informationK227 Java 2
1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html
More information第12回 モナドパーサ
1 関数型プログラミング 第 13 回モナドパーサ 萩野達也 hagino@sfc.keio.ac.jp Slide URL https://vu5.sfc.keio.ac.jp/slide/ 2 モナドパーサ モナドを使って構文解析を行ってみましょう. data Parser a = Parser (String -> Maybe (a, String)) 字句解析も構文解析の一部に含めてしまいます.
More information「計算と論理」 Software Foundations その4
Software Foundations 4 cal17@fos.kuis.kyoto-u.ac.jp http://www.fos.kuis.kyoto-u.ac.jp/~igarashi/class/cal/ November 7, 2017 ( ) ( 4) November 7, 2017 1 / 51 Poly.v ( ) ( 4) November 7, 2017 2 / 51 : (
More information第9回 型とクラス
1 関数型プログラミング 第 9 回型とクラス 萩野達也 hagino@sfc.keio.ac.jp 2 静的型検査と型推論 型 値の集合 Bool = { True, False } Char = { 'a', 'b',... } Int = {... -2, -1, 0, 1, 2, 3,... } 静的型検査 Haskell はコンパイル時に式の型を検査する 静的 = コンパイル時 (v.s.
More information1. A0 A B A0 A : A1,...,A5 B : B1,...,B
1. A0 A B A0 A : A1,...,A5 B : B1,...,B12 2. 3. 4. 5. A0 A, B Z Z m, n Z m n m, n A m, n B m=n (1) A, B (2) A B = A B = Z/ π : Z Z/ (3) A B Z/ (4) Z/ A, B (5) f : Z Z f(n) = n f = g π g : Z/ Z A, B (6)
More information「計算と論理」 Software Foundations その3
Software Foundations 3 cal17@fos.kuis.kyoto-u.ac.jp October 24, 2017 ( ) ( 3) October 24, 2017 1 / 47 Lists.v ( ) ( ) ( ) ( 3) October 24, 2017 2 / 47 ( ) Inductive natprod : Type := pair : nat nat natprod.
More informationEmacs ML let start ::= exp (1) exp ::= (2) fn id exp (3) ::= (4) (5) ::= id (6) const (7) (exp) (8) let val id = exp in
Emacs, {l06050,sasano}@sic.shibaura-it.ac.jp Eclipse Visual Studio Standard ML Haskell Emacs 1 Eclipse Visual Studio variable not found LR(1) let Emacs Emacs Emacs Java Emacs JDEE [3] JDEE Emacs Java 2
More informationProgramming D 1/15
プログラミング D ML 大阪大学基礎工学部情報科学科中田明夫 nakata@ist.osaka-u.ac.jp 教科書 プログラミング言語 Standard ML 入門 6 章 2005/12/19 プログラミング D -ML- 1 2005/12/19 プログラミング D -ML- 2 補足 : 再帰関数の作り方 例題 : 整数 x,y( ただし x
More informationmemo
計数工学プログラミング演習 ( 第 6 回 ) 2016/05/24 DEPARTMENT OF MATHEMATICAL INFORMATICS 1 今日の内容 : 再帰呼び出し 2 分探索木 深さ優先探索 課題 : 2 分探索木を用いたソート 2 再帰呼び出し 関数が, 自分自身を呼び出すこと (recursive call, recursion) 再帰を使ってアルゴリズムを設計すると, 簡単になることが多い
More informationJavaからScalaへ
#01 Java Scala (NISHIMOTO Keisuke) keisuken@cappuccino.ne.jp Java #01 Java Scala 2 (NISHIMOTO Keisuke) Twitter: @keisuke_n (follow,remove,block ) Java Scala Web GUI/ #01 Java Scala 3 29 Ruby/Rails Scala
More information第10回 モジュール
1 FUNCTIONAL PROGRAMMING 第 10 回モジュール 萩野達也 hagino@sfc.keio.ac.jp 2 モジュール モジュールは以下のエンティティを含みます. 変数 型コンストラクタ データコンストラクタ フィールドラベル 型クラス クラスメソッド Java のパッケージに似ている 名前空間はモジュールごとに分かれている 名前 ( 識別子 ) はモジュールで一意的でなくてはいけない
More informationProlog Prolog (GNU Prolog) PROLOG (PROgramming in LOGic) 1972 A. Colmerauer LISP Bruce A. Tate 7 7 Ruby, Io, Prolog, Scala, Erlang, Clojure, and Haske
Prolog Prolog (GNU Prolog) PROLOG (PROgramming in LOGic) 1972 A. Colmerauer LISP Bruce A. Tate 7 7 Ruby, Io, Prolog, Scala, Erlang, Clojure, and Haskell 23 3200 GNU Prolog Prolog Prolog mg :- mgo, h2.
More information20分でわかる Purely Functional Data Structures
20 分でわかる Purely Functional Data Structures k.inaba (http://www.kmonos.net/) Apr. 4, 2010 あらすじ 遅デいータ構造は イミュータブル Immutable Object だけで作るデータ構造 この本の 内 容を 全速力で 布教する お題 : キュー (Queue) FIFO (First-In First-Out)
More informationTerminal ocaml $ ocaml Objective Caml version # 1+2;;<ret> # 1+2;; - : int = 3 ;; OCaml <ret> - : int = 3 OC
Jacques Garrigue, 2013 8 8-9 OCaml 1 OCaml OCaml ML ML Haskell ML Haskell ML 70 Edinburgh LCF Robin Milner 1 Caml ML OCaml OCaml OCaml-Nagoya OCaml 2007 in OCaml 2007 (Computer Science Library 3) 2007
More informationLIFO(last in first out, ) 1 FIFO(first in first out, ) 2 2 PUSH POP : 1
2007 7 17 2 1 1.1 LIFO(last in first out, ) 1 FIFO(first in first out, ) 2 2 PUSH POP 2 2 5 5 5 1: 1 2 データの追加 データの取り出し 5 2 5 2 5 2: 1.2 [1] pp.199 217 2 (binary tree) 2 2.1 (three: ) ( ) 秋田高専 校長 準学士課程学生
More informationCondition DAQ condition condition 2 3 XML key value
Condition DAQ condition 2009 6 10 2009 7 2 2009 7 3 2010 8 3 1 2 2 condition 2 3 XML key value 3 4 4 4.1............................. 5 4.2...................... 5 5 6 6 Makefile 7 7 9 7.1 Condition.h.............................
More informationつくって学ぶプログラミング言語 RubyによるScheme処理系の実装
Ruby Scheme 2013-04-16 ( )! SICP *1 ;-) SchemeR SICP MIT * 1 Structure and Interpretaion of Computer Programs 2nd ed.: 2 i SchemeR Ruby Ruby Ruby Ruby & 3.0 Ruby ii https://github.com/ichusrlocalbin/scheme_in_ruby
More informationr08.dvi
19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev
More informationr3.dvi
/ 94 2 (Lisp ) 3 ( ) 1994.5.16,1994.6.15 1 cons cons 2 >(cons a b) (A. B).? Lisp (S ) cons 2 car cdr n A B C D nil = (A B C D) nil nil A D E = (A (B C) D E) B C E = (A B C D. E) A B C D B = (A. B) A nil.
More information4 ソフトウェア工学 Software Engineering 抽象データ型 ABSTRACT DATA TYPE データ抽象 (data abstraction) 目的 : データ構造を ( 実装に依存せずに ) 抽象的に定義 方法 : データにアクセス (read, write) する関数の仕様
4 ソフトウェア工学 Software Engineering 抽象データ型 STRT DT TYPE データ抽象 (data abstraction) 目的 : データ構造を ( 実装に依存せずに ) 抽象的に定義 方法 : データにアクセス (read, write) する関数の仕様のみを記述 スタック (stack) の例 D push(d,s) S) pop(s) top(s)= top(s)=
More informationohp08.dvi
19 8 ( ) 2019.4.20 1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: 2 (2) NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( 2) 3 (3) head cur tail head cur prev data
More informationuntitled
II 4 Yacc Lex 2005 : 0 1 Yacc 20 Lex 1 20 traverse 1 %% 2 [0-9]+ { yylval.val = atoi((char*)yytext); return NUM; 3 "+" { return + ; 4 "*" { return * ; 5 "-" { return - ; 6 "/" { return / ; 7 [ \t] { /*
More informationBoo Boo 2 Boo 2.NET Framework SDK 2 Subversion 2 2 Java 4 NAnt 5 Boo 5 5 Boo if 11 for 11 range 12 break continue 13 pass
Boo Boo 2 Boo 2.NET Framework SDK 2 Subversion 2 2 Java 4 NAnt 5 Boo 5 5 Boo 6 6 7 9 10 11 if 11 for 11 range 12 break continue 13 pass 13 13 14 15 15 23 23 24 24 24 25 import 26 27-1- Boo Boo Python CLI.NET
More information10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV
tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 12 11 p.1/33 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20
More informationJavaScript 1.! DOM Ajax Shelley Powers,, JavaScript David Flanagan, JavaScript 2
JavaScript (2) 1 JavaScript 1.! 1. 2. 3. DOM 4. 2. 3. Ajax Shelley Powers,, JavaScript David Flanagan, JavaScript 2 (1) var a; a = 8; a = 3 + 4; a = 8 3; a = 8 * 2; a = 8 / 2; a = 8 % 3; 1 a++; ++a; (++
More information1 (2 * 3) 1 2 * 3 Preorder In order Post order 1 * 1 * Breadth-first Depth-first * * 3 Preorder: 1 * 2 3 In order: 1 2 * 3 Post orde
5 LL recursive descent LL(1) 2006.05.19 ::= ::= ::=
More information1 # include < stdio.h> 2 # include < string.h> 3 4 int main (){ 5 char str [222]; 6 scanf ("%s", str ); 7 int n= strlen ( str ); 8 for ( int i=n -2; i
ABC066 / ARC077 writer: nuip 2017 7 1 For International Readers: English editorial starts from page 8. A : ringring a + b b + c a + c a, b, c a + b + c 1 # include < stdio.h> 2 3 int main (){ 4 int a,
More informationmemo
計数工学プログラミング演習 ( 第 6 回 ) 2017/05/16 DEPARTMENT OF MATHEMATICAL INFORMATICS 1 今日の内容 : 再帰呼び出し 2 分探索木 深さ優先探索 課題 : 2 分探索木を用いたソート 2 再帰呼び出し 関数が, 自分自身を呼び出すこと (recursive call, recursion) 再帰を使ってアルゴリズムを設計すると, 簡単になることが多い
More information2 JSON., 2. JSON,, JSON Jaql [9] Spark Streaming [8], Spark [7].,, 2, 3 4, JSON [3], Jaql [9], Spark [7] Spark Streaming [8] JSON JSON [
DEIM Forum 2016 G1-4,, 305 8573 1-1-1 305 8573 1-1-1 305 8573 1-1-1 E-mail: denam96@kde.cs.tsukuba.ac.jp, {shiokawa,kitagawa}@cs.tsukuba.ac.jp,,.,,,.,, (1), (2),.,, 1.,.,,.,,,,, Storm [2] STREAM [5], S4
More information01_.g.r..
I II III IV V VI VII VIII IX X XI I II III IV V I I I II II II I I YS-1 I YS-2 I YS-3 I YS-4 I YS-5 I YS-6 I YS-7 II II YS-1 II YS-2 II YS-3 II YS-4 II YS-5 II YS-6 II YS-7 III III YS-1 III YS-2
More informationohp07.dvi
17 7 (2) 2017.9.13 1 BNF BNF ( ) ( ) 0 ( ) + 1 ( ) ( ) [ ] BNF BNF BNF prog ::= ( stat ) stat ::= ident = expr ; read ident ; print expr ; if ( expr ) stat while ( expr ) stat { prog expr ::= term ( +
More information10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV
tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 11 20 p.1/34 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20
More informationr07.dvi
19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1
More information2016select追加小冊子_0704出稿0706修正.indd
-JPN3 -JPN3 -G1 -G1 -G3 -OP -OP -OP -G3 -G3 -G3 -G3 -G3 -L -L -G1 -JPN1 -OP -G3 -OP -JPN2 -G3 -JPN1 -G3 -G3 -L-L -L -L -G3 -L -L -G2 -L -G3 -G1 -G2 -G2 -G3 -L -G1 -G2 -G3 -G1 -G3 -L -L -L -G3 -G3 -L -G1
More informationohp07.dvi
19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5
More informationohp02.dvi
172 2017.7.16 1 ? X A B A X B ( )? IBMPL/I FACOM PL1 ( ) X 2 ( ) 3 2-0 ( ) ( ) ( ) (12) ( ) (112) 31) 281 26 1 4 (syntax) (semantics) ( ) 5 BNF BNF(Backus Normal Form) Joun Backus (grammer) English grammer
More informationuntitled
II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}
More informationML Edinburgh LCF ML Curry-Howard ML ( ) ( ) ( ) ( ) 1
More Logic More Types ML/OCaml GADT Jacques Garrigue ( ) Jacques Le Normand (Google) Didier Rémy (INRIA) @garriguejej ocamlgadt ML Edinburgh LCF ML Curry-Howard ML ( ) ( ) ( ) ( ) 1 ( ) ML type nebou and
More informationjavascript key
Associate Professor Department of International Social Studies KYOAI GAKUEN UNIVERSITY Email: ogashiwa@c.kyoai.ac.jp, ogashiwa@wide.ad.jp sample
More information2
OCaml Web HTML5 IT PPL 2012 Web 2012 8 21 ( ) 14:30-17:30 2 Web JavaScript HTML5 3 Web JavaScript CoffeeScript Dart Haxe S2JS (Scala) JSX Ocamljs, Js_of_ocaml (OCaml) 4 OCaml 5 6 js_of_ocaml 7 OCaml Web
More information2015-s6-4g-pocket-guidebook_H1-4.indd
56C504-01 2 47 47 32 3435 35 2124 26 26 26 424343 434446 4646 12 14 16 18 20 4 28 30 31 36 37 38 42 47 48 49 4 4 4 3 4 5 16 16 6 6 18 18 32 32 30 30 7 20 20 8 9 28 31 10 Do you have a? 36 Do you have
More informationO28
ループ書いたら負けかなと思っている uskz 自己紹介 梶本裕介 25 歳 ループ嫌い 抽象度が低すぎる accumulate? transform? 範囲とかいちいち気にしないといけないのが嫌 形式的な扱いが面倒くさい int f(int a, int b, int c) { return 3 * a + 3 * b + 3 * c; } int f(int a, int b, int c) {
More information34 (2017 ),,.,,,,,.,,,,., [13],.,,,.,. 1,,, [7].,,,,., Leon [8], Synquid [9], SMT CVC4 [10].,., Functional Program Synthesis from Relational Specifica
34 (2017 ),,.,,,,,.,,,,., [13],.,,,.,. 1,,, [7].,,,,., Leon [8], Synquid [9], SMT CVC4 [10].,., Functional Program Synthesis from Relational Specifications. This is an unrefereed paper. Copyrights belong
More information紀要1444_大扉&目次_初.indd
1. Hi, How are you? / What s up? / How s it going? A / Nice talking to you. 2. Oh really? / That s great! / That s A, B interesting! / Are you serious? / Sounds good. / You too! / That s too bad. 3. Sorry?
More informations
s073083 23 3 17 1 2 1.1.............................. 2 1.2.............................. 2 1.3.............................. 3 2 4 2.1........................... 4 2.2 Google App Engine........................
More information:30 12:00 I. I VI II. III. IV. a d V. VI
2017 2017 08 03 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF X [ S ] a S S ; X X X, S [, a, ], ; BNF X (parse tree) (1) [a;a] (2) [[a]] (3) [a;[a]] (4) [[a];a] : [a] X 2 222222
More information1.
3 ( ) 1. n Tiny C n yacc (bison) lex (flex) n IA n n n n n n (lex ) 50 (yacc ) 400 200 550 n n yacc/lex TA Tiny C n C n int n (if, while) int fact(int n) {! if (n == 1) return 1;! else return n * fact(n-1);!
More informationuntitled
146,650 168,577 116,665 122,915 22,420 23,100 7,564 22,562 140,317 166,252 133,581 158,677 186 376 204 257 5,594 6,167 750 775 6,333 2,325 298 88 5,358 756 1,273 1,657 - - 23,905 23,923 1,749 489 1,309
More informationjoho07-1.ppt
0xbffffc5c 0xbffffc60 xxxxxxxx xxxxxxxx 00001010 00000000 00000000 00000000 01100011 00000000 00000000 00000000 xxxxxxxx x y 2 func1 func2 double func1(double y) { y = y + 5.0; return y; } double func2(double*
More informationJavaScript Web Web Web Web Web JavaScript Web Web JavaScript JavaScript JavaScript GC GC GC GC JavaScript SSJSVM GC SSJSVM GC GC GC SSJSVM GC GC SSJSV
27 JavaScript Design and Implementation of a Mark Sweep Garbage Collection on a Server Side JavaScript Virtual Machine 1160326 2016 2 26 JavaScript Web Web Web Web Web JavaScript Web Web JavaScript JavaScript
More informationtuat1.dvi
( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )
More information連立1次方程式Ax=bの解法:公式にしたがって解くのは,計算量大
Common Lisp プログラミング入門 概要 Lisp は記号の構造的な表現である S 式を操作するインタープリタ方式を基調とするプログラミング言語である. ここでは, 思考のツールとしての Lisp を強調した解説を行う.. Lisp のしくみ Lisp で中心となるのは,S 式 (Symbolic Expression) と呼ばれる記号の構造的な表現である.Lisp ユーザはインタープリタを使って,S
More informationMEET 270
Traditional Idiom & Slang can t make heads or tails of something Keener : I m not sure now if I want to marry Gloria or not. I still love Lisa. Slacker : Really. What are you going to do? Keener : I don
More information( ) ( ) lex LL(1) LL(1)
() () lex LL(1) LL(1) http://www.cs.info.mie-u.ac.jp/~toshi/lectures/compiler/ 29 5 14 1 1 () / (front end) (back end) (phase) (pass) 1 2 1 () () var left, right; fun int main() { left = 0; right = 10;
More information1/8 ページ Java 基礎文法最速マスター Java Javaの文法一覧です 他の言語をある程度知っている人はこれを読めばJavaの基礎をマスターしてJavaを書くことができるようになっています 簡易リファレンスとしても利用できると思いますので これは足りないと思うものがあれば教えてください 1. 基礎 class の作成プログラムはclassに記述します たとえばSampleという名前のclassを作る場合
More information# let rec sigma (f, n) = # if n = 0 then 0 else f n + sigma (f, n-1);; val sigma : (int -> int) * int -> int = <fun> sigma f n ( : * -> * ) sqsum cbsu
II 4 : 2001 11 7 keywords: 1 OCaml OCaml (first-class value) (higher-order function) 1.1 1 2 + 2 2 + + n 2 sqsum 1 3 + 2 3 + + n 3 cbsum # let rec sqsum n = # if n = 0 then 0 else n * n + sqsum (n - 1)
More informationI 2 tutimura/ I 2 p.1/??
I 2 tutimura@mist.i.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/ 2002 4 25 I 2 p.1/?? / / Makefile I 2 p.2/?? Makefile make GNU make I 2 p.3/?? Makefile L A T E X I 2 p.4/?? core (1) gcc,
More informationVDM-SL VDM VDM-SL Toolbox VDM++ Toolbox 1 VDM-SL VDM++ Web bool
VDM-SL VDM++ 23 6 28 VDM-SL Toolbox VDM++ Toolbox 1 VDM-SL VDM++ Web 2 1 3 1.1............................................... 3 1.1.1 bool......................................... 3 1.1.2 real rat int
More information1.3 ( ) ( ) C
1 1.1 (Data Base) (Container) C++ Java 1.2 1 1.3 ( ) ( ) 1. 2. 3. C++ 2 2.1 2.2 2.3 2 C Fortran C++ Java 3 3.1 (Vector) 1. 2. ( ) 3.2 3 3.3 C++ C++ STL C++ (Template) vector vector< > ; int arrayint vector
More informationendo.PDF
MAP 18 19 20 21 3 1173 MAP 22 700800 106 3000 23 24 59 1984 358 358 399 25 12 8 1996 3 39 24 20 10 1998 9,000 1,400 5,200 250 12 26 4 1996 156 1.3 1990 27 28 29 8 606 290 250 30 11 24 8 1779 31 22 42 9
More information2018 年度前期プロジェクト活動 Ritsumeikan Compiler Construction 班活動報告書 佐々木章徳青木雅典西見元希松本幸大
2018 年度前期プロジェクト活動 Ritsumeikan Compiler Construction 班活動報告書 佐々木章徳青木雅典西見元希松本幸大 目次 1. 活動の概要 2. 関数型プログラミング言語 3. Standard ML 3.1 Standard ML の特徴 3.2 開発環境 3.3 式の評価, 束縛, 関数, コメント, ファイル 3.4 主なデータ型 3.5 関数定義, パターンマッチング,
More information1 NScripter 1 [ NScripter ] NScripter NScripter 2 nathki bugyo 1 http://www.shuwasystem.co.jp/cgi-bin/detail.cgi?isbn=4-7980-1104-5 2 http://www.pulltop.com/gp04/ 2 NScripter NScripter BASIC ( ) NScLisper
More informationScalaFukuoka 2017 Backlog.key
[T] => -> Option Optional val & var let & var for implicit class Foo(val a: String) { def foo: Int = 3 * a.toint } 9.foo extension String { var foo: Int { return 3 * Int(self)! } } 9.foo struct Foo
More informationSmartBrowser_document_build30_update.pptx
SmartBrowser Update for ios / Version 1.3.1 build30 2017 年 8 月 株式会社ブルーテック 更新内容 - 概要 ios Version 1.3.1 build28 の更新内容について 1. 設定をQRから読み込み更新する機能 2.URLをQRから読み込み画面遷移する機能 3.WEBページのローカルファイル保存と外部インテントからの起動 4.JQuery-LoadImageライブラリの組み込み
More information