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

Size: px
Start display at page:

Download "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"

Transcription

1 3 Haskell Haskell Haskell C Java 3.1 Haskell Haskell GHC (Glasgow Haskell Compiler 1 ) GHC Haskell GHC 1 Guarded Horn Clauses III - 1

2 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 expr :cd directory :c :! command command :? :quit :q GHCi Prelude> Haskell 3.3 Haskell Haskell Haskell Haskell C = III - 2

3 { } 1 = 1 ; 2 = 2 ;... ; n = n { } ; C _ Haskell 1 module where module where { 1 = 1 ; 2 = 2 ;... ; n = n } import 1 1 module where Main Haskell 1 = 1 2 = 2... n = n Haskell λ Y=. λx.x λxy.y Haskell III - 3

4 C c0 = \ f x -> x c1 = \ f x -> f x c2 = \ f x -> f (f x) true = \ t f -> t false = \ t f -> f = c0 f x = x c1 f x = f x c2 f x = f (f x) true t f = t false t f = f Haskell Haskell Bool Int, Integer Int, Integer Float, Double Char Bool Integer, Float, Double, Char C Lisp +, -, * 1+2*3 if then else if 1 then 2 else True 2 False 3 if then else Haskell factorial Haskell fact n = if n==0 then 1 else n*fact(n-1) fact(n-1) fact n-1 n*(fact(n-1)) fact 100 III - 4

5 Scheme Lisp Haskell (cons) [] : : 1:2:[] 1:(2:[]), [ ] [1,2,3,4] Integer Double Haskell String type String = [Char] type = type alias String [Char] box-pointer xs0 = [] xs1 = 1:xs0 xs2 = 2:xs1 xs3 = 3:xs2 xs3 xs2 xs : 2 1, 2, 3 [[1,2],[3,4]] III - 5

6 box-pointer 1. [2,3,5,7,11] 2. [0] 3. [[1],[2,3,4],[]] C struct _list { int car; struct _list* cdr; }; typedef struct _list* list; _list car cdr 2 cdr list typedef struct _list* C C NULL malloc C free Haskell free tuple, ( ) (1, a ) (2, b, [3]) 2 -> Integer -> Char Integer Char -> Bool -> Bool -> Bool 2 Haskell type class III - 6

7 Integer Char a b [a] -> [b] -> [(a, b)] [Char] -> [Integer] -> [(Char, Integer)] [String] -> [Integer -> Integer] -> [(String, Integer -> Integer)] Haskell :: :: fact fact :: Integer -> Integer fact n = if n==0 then 1 else n*fact(n-1) Haskell 3.5 Haskell 3 -- Prelude length mylength :: [a] -> Integer mylength [] = 0 mylength (x:xs) = 1 + mylength xs mylength [] x xs mylength length :: [a] -> Int _ mylength x mylength (_:xs) = 1 + mylength xs case of case of case 0 of { 1 -> 1 ; 2 -> 2 ; 3 III - 7

8 }... n -> n m m if 1 then 2 else 3 case of case 1 of { True -> 2 ; False -> 3 } let λ \ (x:xs) -> x head mysum [Bool] 2 frombin :: [Bool] -> Integer frombin [True, True] 3, frombin [True, False, True, False] 10 : xs f f sumf :: [Double] -> (Double -> Double) -> Double reverse: -- append Prelude (++) append :: [a] -> [a] -> [a] append [] ys = ys append (x:xs) ys = x : (append xs ys) -- reverse Prelude reverse :: [a] -> [a] reverse [] = [] reverse (x:xs) = append (reverse xs) [x] III - 8

9 -- shunt rev shunt :: [a] -> [a] -> [a] shunt ys [] = ys shunt ys (x:xs) = shunt (x:ys) xs rev :: [a] -> [a] rev xs = shunt [] xs rev rev reverse xs rev xs = reverse xs shunt ys xs = append (reverse xs) ys : xs = [] : xs = z:zs : xs append xs (append ys zs) = append (append xs ys) zs xs III - 9

10 3.7 Prelude map :: (a -> b) -> [a] -> [b] map f [] = [] map f (x:xs) = f x : map f xs zipwith :: (a -> b -> c) -> [a] -> [b] -> [c] zipwith f (x:xs) (y:ys) = f x y : zipwith xs ys zipwith f = [] filter :: (a -> Bool) -> [a] -> [a] filter p [] = [] filter p (x:xs) = if p x then x : filter p xs else filter p xs iterate :: (a -> a) -> a -> [a] iterate f x = x : iterate f (f x) foldr :: (a -> b -> b) -> b -> [a] -> b foldr f x [] = x foldr f x (y:ys) = f y (foldr f x ys) foldl :: (a -> b -> a) -> a -> [b] -> a foldl f x [] = x foldl f x (y:ys) = foldl (f x y) ys 3.8 Haskell Prelude zip zip :: [a] -> [b] -> [(a,b)] zip (a:as) (b:bs) = (a,b) : zip as bs zip = [] zip [1, 2] [3, 4] [1, 2] zip [3, 4] infixl, infixr, infix III - 10

11 Prelude Haskell infixr 9. infixl 9!! infixr 8 ˆ, ˆˆ, ** infixl 7 *, /, quot, rem, div, mod, :%, % infixl 6 +, - infixr 5 : infixr 5 ++ infix 4 ==, /=, <, <=, >=, >, elem, notelem infixr 3 && infixr 2 infixl 1 >>, >>= infixr 1 =<< infixr 0 $, $!, seq infixl infixr infix 1 < x < 2 2 * + ( ) 1+2 (+) 1 2 let let in pow4 x = let y = x*x in y*y -- head Prelude head ys = let (x:xs) = ys in x 4 pow4 y*y y -- repeat Prelude repeat :: a -> [a] repeat x = let xs = x:xs in xs x Prelude> repeat 1 [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,... 4 Haskell Haskell evalpoly :: [Double] -> Double -> Double [1, 2, 3, 4] 1 + 2x + 3x 2 + 4x 3 evalpoly [1, 2, 3, 4] Ctrl-c III - 11

12 3.8.2 powerset powerset [1, 2, 3] [[], [1], [2], [3], [1, 2], [2, 3], [1, 3], [1, 2, 3]] 3.9 algebraic datatype data k = 1 1,1... 1,n1 2 2,1... 2,n2... m m,1... m,nm C enum data Direction = Up Down Left Right Up, Down, Left, Right 4 Direction data Tree a = Branch (Tree a) a (Tree a) Empty Branch Empty 2 Empty Branch Branch Branch :: a Integer String Tree Integer Integer Tree (type constructor) Tree Empty :: Tree a Branch Empty 1 Empty :: Tree Integer Branch (Branch Empty "a" Empty) "b" (Branch Empty "c" Empty) :: Tree String Branch (Branch Empty 1 Empty) 2 (Branch Empty 3 (Branch Empty 4 Empty)) :: Tree Integer III - 12

13 Tree size :: Tree a -> Integer -- depth :: Tree a -> Integer -- preorder :: Tree a -> [a] -- postorder :: Tree a -> [a] -- reflect :: Tree a -> Tree a Haskell Haskell twice twice x = x*x twice (2+2) twice (2 + 2) = (2 + 2) (2 + 2) = 4 4 = 16 twice (2+2) twice ( * ) twice * * 4 16 lazy evaluation III - 13

14 from :: Integer -> [Integer] from n = n : from (n+1) -- take Prelude take :: Integer -> [a] -> [a] take 0 _ = [] take _ [] = [] take n (x:xs) = x : take (n-1) xs from 1 [1, 2, 3,... ] take 3 (from 1) take 3 (from 1) take 3 (1:from (1+1)) 1:(take 2 (from (1+1))) 1:(take 2 ((1+1):from (1+1+1))) 1:(1+1):(take 1 (from (1+1+1))) 1:(1+1):(1+1+1):(take 0 (from ( ))) 1:(1+1):(1+1+1):[] (=[1, 2, 3]) from.. Prelude> [1..] [1,2,3,4,5,6,7,8,9,10,11,... Prelude> [2,4..] [2,4,6,8,10,12,14,16,18,20,22,... Prelude> [1..10] [1,2,3,4,5,6,7,8,9,10] Prelude> [1,4..20] [1,4,7,10,13,16,19] [6] take n mydrop :: -> [a] Integer -> [a] fib merge i 3 j 5 k i, j, k 0 hamming Haskell 3.11 List Comprehension Haskell List Comprehension syntax sugar III - 14

15 Prelude> [(x, y) x <- [1, 2, 3, 4], y <- [5, 6, 7]] [(1,5),(1,6),(1,7),(2,5),(2,6),(2,7),(3,5),(3,6),(3,7),(4,5),(4,6),(4,7)] Prelude> [x*x x <- [1..10], odd x] [1,9,25,49,81] [1..10] [1,2,3,4,5,6,7,8,9,10] [,..., ] Bool : < n 0 x y n x, y foo :: Integer -> [(Integer, Integer)] n 0 < x < y < z n x 2 + y 2 = z 2 x, y, z chokkaku :: Integer -> [(Integer, Integer, Integer)] -- 1 unit :: a -> [a] unit a = a : [] bind :: [a] -> (a -> [b]) -> [b] bind [] _ = [] bind (x:xs) f = append (f x) (bind xs f) [t] unit t [t x <- u, P] bind u (\ x -> [t P]) [t b, P] if b then [t P] else [] b Bool P qsort [] = [] qsort (x:xs) = qsort [ y y <- xs, y < x] ++ x : qsort [ y y <- xs, y >= x] unit, bind 1. [(x, y) x <- [1, 2, 3, 4], y <- [5, 6, 7]] 2. [x*x x <- [1..10], odd x] primes [2, 3, 5, 7, 11,... ] III - 15

16 : (Eratosthenes) C [4, 6, 1, 5, 2, 8, 3, 7] III - 16

17 safe p n length p p length p + 1 n safe p n = all not [ check (i, j) (1+length p, n) (i, j) <- zip [1..] p ] check (i,j) (m,n) = j==n (i+j==m+n) (i-j==m-n) all all all p [] all p (x:xs) :: (a -> Bool) -> [a] -> Bool = True = if p x then all p xs else False [1..] [1, 2, 3,... ] > safe [1, 3] 5 True > safe [1, 3] 2 False m ( ) queens III - 17

18 queens 0 = [[]] queens m = [ append p [n] p<-queens (m-1), n<-[1..8], safe p n ] > queens 1 [[1], [2], [3], [4], [5], [6], [7], [8]] > queens 2 [[1,3],[1,4],[1,5],[1,6],[1,7],[1,8],[2,4],[2,5],[2,6],[2,7],[2,8], [3,1],[3,5],[3,6],[3,7],[3,8],[4,1],[4,2],[4,6],[4,7],[4,8],[5,1], [5,2],[5,3],[5,7],[5,8],[6,1],[6,2],[6,3],[6,4],[6,8],[7,1],[7,2], [7,3],[7,4],[7,5],[8,1],[8,2],[8,3],[8,4],[8,5],[8,6]] head (queens 8) > head (queens 8) [1,5,8,6,3,7,2,4] [1, 5, 8, 6, 3, 7, 2, 4] queens 7 queens 7 head (queens 8) Prolog (backtrack) 1 1 queens 8 > queens 8 [[1,5,8,6,3,7,2,4],[1,6,8,3,7,4,2,5], ( ),[8,3,1,6,2,5,7,4],[8,4,1,3,6,2,7,5]] 92 [1] Haskell A Purely Functional Language featuring static typing, higher-order functions, polymorphism, type classes and monadic effects Haskell [2] Programming in Haskell Haskell [3] Simon Peyton Jones, John Hughes Haskell 98: A Non-strict, Purely Functional Language , Haskell Haskell [4] Mark P Jones, Alastair Reid The Hugs 98 User Manual Haskell Hugs III - 18

19 [5] Simon Peyton Jones, David Lester Implementing Functional Languages Prentice Hall, Haskell [6] John Hughes Why Functional Programming Matters 1989, rjmh/papers/whyfp.html [7] Philip Wadler List Comprehensions Simon Peyton Jones The Implementation of Functional Programming Languages Prentice Hall, [8] Haskell [9] Simon Peyton Jones Wearing the hair shirt A retrospective on Haskell 2003, simonpj/papers/haskell%2dretrospective/ Haskell Haskell [10] Richard Bird, Philip Wadler, , ISBN Haskell Miranda [11] Haskell, , ISBN [12] Haskell, , ISBN III - 19

3 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 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 information

2

2 2011.11.11 1 2 MapReduce 3 4 5 6 Functional Functional Programming 7 8 9 10 11 12 13 [10, 20, 30, 40, 50] 0 n n 10 * 0 + 20 * 1 + 30 * 2 + 40 * 3 + 50 *4 = 400 14 10 * 0 + 20 * 1 + 30 * 2 + 40 * 3 + 50

More information

haskell.gby

haskell.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 information

2

2 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 information

Copyright c 2006 Zhenjiang Hu, All Right Reserved.

Copyright 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 information

# let st1 = {name = "Taro Yamada"; id = };; val st1 : student = {name="taro Yamada"; id=123456} { 1 = 1 ;...; n = n } # let string_of_student {n

# 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

Copyright c 2008 Zhenjiang Hu, All Right Reserved.

Copyright 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

fp.gby

fp.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 information

Functional Programming

Functional Programming PROGRAMMING IN HASKELL プログラミング Haskell Chapter 7 - Higher-Order Functions 高階関数 愛知県立大学情報科学部計算機言語論 ( 山本晋一郎 大久保弘崇 2013 年 ) 講義資料オリジナルは http://www.cs.nott.ac.uk/~gmh/book.html を参照のこと 0 Introduction カリー化により

More information

Parametric Polymorphism

Parametric 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 information

2011.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 information

monad.gby

monad.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

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

¥×¥í¥°¥é¥ß¥ó¥°±é½¬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

bdd.gby

bdd.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 information

6-1

6-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 information

r07.dvi

r07.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 information

ohp07.dvi

ohp07.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 information

presen.gby

presen.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 information

Functional Programming

Functional 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 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

# 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 information

1. A0 A B A0 A : A1,...,A5 B : B1,...,B

1. 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

Microsoft PowerPoint - ProD0107.ppt

Microsoft 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 information

5 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, 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 information

Jacques Garrigue

Jacques 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 information

test.gby

test.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 information

連載 構文解析器結合子 山下伸夫 (( 株 ) タイムインターメディア ) 文字列の分解 1 1 Haskell lines Prelude lines :: String -> [String] lines "" = [] lines s = let (l,s'

連載 構文解析器結合子 山下伸夫 (( 株 ) タイムインターメディア ) 文字列の分解 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

第8回 関数

第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 information

kyoto.gby

kyoto.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 information

r03.dvi

r03.dvi 19 ( ) 019.4.0 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void... argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0 a a \0 b b b \0 c c c \0 1: // argdemo1.c ---

More information

(CC Attribution) Lisp 2.1 (Gauche )

(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

1. 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 information

ohp03.dvi

ohp03.dvi 19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0

More information

10/ / /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

10/ / /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 information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) double

More information

: gettoken(1) module P = Printf exception End_of_system (* *) let _ISTREAM = ref stdin let ch = ref ( ) let read () = (let c =!ch in ch := inp

: gettoken(1) module P = Printf exception End_of_system (* *) let _ISTREAM = ref stdin let ch = ref ( ) let read () = (let c =!ch in ch := inp 7 OCaml () 1. 2. () (compiler) (interpreter) 2 OCaml (syntax) (BNF,backus normal form ) 1 + 2; let x be 2-1 in x; ::= ; let be in ; ::= + - ::= * / ::= 7.1 ( (printable characters) (tokens) 1 (lexical

More information

untitled

untitled 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 information

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1

/ 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 information

K227 Java 2

K227 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

ohp02.dvi

ohp02.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 information

Programming D 1/15

Programming 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 information

LIFO(last in first out, ) 1 FIFO(first in first out, ) 2 2 PUSH POP : 1

LIFO(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 information

jssst-ocaml.mgp

jssst-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 information

I 2 tutimura/ I 2 p.1/??

I 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 information

PowerPoint Presentation

PowerPoint Presentation 練習問題 8 の解答例 プログラミング D 大阪大学基礎工学部情報科学科中田明夫 nakata@ist.osaka-u.ac.jp プログラミング D -ML- 1 次の関数の型を推論し その理由を説明せよ fun foo (a,b,c,d:real) = if ab then c else d; 引数 a,b,c,dの型をそれぞれ 'a,'b,'c,'dとおく

More information

r02.dvi

r02.dvi 172 2017.7.16 1 1.1? X A B A X B ( )? IBMPL/I FACOM PL1 ( ) X ( ) 1.2 1 2-0 ( ) ( ) ( ) (12) ( ) (112) (131) 281 26 1 (syntax) (semantics) ( ) 2 2.1 BNF BNF(Backus Normal Form) Joun Backus (grammer) English

More information

1

1 2 章 1 整数を一つ読み込み, その階乗を計算する RAM プログラムを書け f (n) = n! ( n 0) 何でもよい ( n

More information

untitled

untitled 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 information

「計算と論理」 Software Foundations その4

「計算と論理」  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

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double

More information

koba/class/soft-kiso/ 1 λ if λx.λy.y false 0 λ typed λ-calculus λ λ 1.1 λ λ, syntax τ (types) ::= b τ 1 τ 2 τ 1

koba/class/soft-kiso/ 1 λ if λx.λy.y false 0 λ typed λ-calculus λ λ 1.1 λ λ, syntax τ (types) ::= b τ 1 τ 2 τ 1 http://www.kb.ecei.tohoku.ac.jp/ koba/class/soft-kiso/ 1 λ if λx.λy.y false 0 λ typed λ-calculus λ λ 1.1 λ 1.1.1 λ, syntax τ (types) ::= b τ 1 τ 2 τ 1 τ 2 M (terms) ::= c τ x M 1 M 2 λx : τ.m (M 1,M 2

More information

ML λ λ 1 λ 1.1 λ λ λ e (λ ) ::= x ( ) λx.e (λ ) e 1 e 2 ( ) ML λx.e Objective Caml fun x -> e x e let 1

ML λ λ 1 λ 1.1 λ λ λ e (λ ) ::= x ( ) λx.e (λ ) e 1 e 2 ( ) ML λx.e Objective Caml fun x -> e x e let 1 2005 sumii@ecei.tohoku.ac.jp 2005 6 24 ML λ λ 1 λ 1.1 λ λ λ e (λ ) ::= x ( ) λx.e (λ ) e 1 e 2 ( ) ML λx.e Objective Caml fun x -> e x e let 1 let λ 1 let x = e1 in e2 (λx.e 2 )e 1 e 1 x e 2 λ 3 λx.(λy.e)

More information

1.

1. 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 information

ML Edinburgh LCF ML Curry-Howard ML ( ) ( ) ( ) ( ) 1

ML 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 information

Int Int 29 print Int fmt tostring 2 2 [19] ML ML [19] ML Emacs Standard ML M M ::= x c λx.m M M let x = M in M end (M) x c λx.

Int Int 29 print Int fmt tostring 2 2 [19] ML ML [19] ML Emacs Standard ML M M ::= x c λx.m M M let x = M in M end (M) x c λx. 1, 2 1 m110057@shibaura-it.ac.jp 2 sasano@sic.shibaura-it.ac.jp Eclipse Visual Studio ML Standard ML Emacs 1 ( IDE ) IDE C C++ Java IDE IDE IDE IDE Eclipse Java IDE Java Standard ML 1 print (Int. 1 Int

More information

Microsoft PowerPoint - IntroAlgDs-06-8.ppt

Microsoft 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 information

1. A0 A B A0 A : A1,...,A5 B : B1,...,B

1. 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 f : A B 4 (i) f (ii) f (iii) C 2 g, h: C A f g = f h g = h (iv) C 2 g, h: B C g f = h f g = h 4 (1) (i) (iii) (2) (iii) (i) (3) (ii) (iv) (4)

More information

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 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 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

第12回 モナドパーサ

第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

2 1 Web Java Android Java 1.2 6) Java Java 7) 6) Java Java (Swing, JavaFX) (JDBC) 7) OS 1.3 Java Java

2 1 Web Java Android Java 1.2 6) Java Java 7) 6) Java Java (Swing, JavaFX) (JDBC) 7) OS 1.3 Java Java 1 Java Java 1.1 Java 1) 2) 3) Java OS Java 1.3 4) Java Web Start Web / 5) Java C C++ Java JSP(Java Server Pages) 1) OS 2) 3) 4) Java Write Once, Run Anywhere 5) Java Web Java 2 1 Web Java Android Java

More information

第9回 型とクラス

第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 information

untitled

untitled C -1 - -2 - concept lecture keywords FILE, fopen, fclose, fscanf, fprintf, EOF, r w a, typedef gifts.dat Yt JZK-3 Jizake tsumeawase 45 BSP-15 Body soap set 3 BT-2 Bath towel set 25 TEA-2 Koutya

More information

cpp1.dvi

cpp1.dvi 2017 c 1 C++ (1) C C++, C++, C 11, 12 13 (1) 14 (2) 11 1 n C++ //, [List 11] 1: #include // C 2: 3: int main(void) { 4: std::cout

More information

パズルをSugar制約ソルバーで解く

パズルをSugar制約ソルバーで解く Sugar 1 2 3 1 CSPSAT 2008 8 21 Sugar 1 2 3 Sugar Sugar (CSP) (SAT ) (encode) SAT SAT order encoding direct encoding support encoding http://bachistckobe-uacjp/sugar/ Web Sugar 1 2 3 Sugar SAT (COP) MAX-CSP

More information

つくって学ぶプログラミング言語 RubyによるScheme処理系の実装

つくって学ぶプログラミング言語 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 information

新・明解Java入門

新・明解Java入門 537,... 224,... 224,... 32, 35,... 188, 216, 312 -... 38 -... 38 --... 102 --... 103 -=... 111 -classpath... 379 '... 106, 474!... 57, 97!=... 56 "... 14, 476 %... 38 %=... 111 &... 240, 247 &&... 66,

More information

Java updated

Java updated Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................

More information

ScalaFukuoka 2017 Backlog.key

ScalaFukuoka 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 information

Emacs 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 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 information

VDM-SL VDM VDM-SL Toolbox VDM++ Toolbox 1 VDM-SL VDM++ Web bool

VDM-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 information

2018 年度前期プロジェクト活動 Ritsumeikan Compiler Construction 班活動報告書 佐々木章徳青木雅典西見元希松本幸大

2018 年度前期プロジェクト活動 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 information

1 # 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

1 # 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 information

r1.dvi

r1.dvi 2006 1 2006.10.6 ( 2 ( ) 1 2 1.5 3 ( ) Ruby Java Java Java ( Web Web http://lecture.ecc.u-tokyo.ac.jp/~kuno/is06/ / ( / @@@ ( 3 ) @@@ : ( ) @@@ (Q&A) ( ) 1 http://www.sodan.ecc.u-tokyo.ac.jp/cgi-bin/qbbs/view.cgi

More information

Condition DAQ condition condition 2 3 XML key value

Condition 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

解きながら学ぶJava入門編

解きながら学ぶJava入門編 44 // class Negative { System.out.print(""); int n = stdin.nextint(); if (n < 0) System.out.println(""); -10 Ÿ 35 Ÿ 0 n if statement if ( ) if i f ( ) if n < 0 < true false true false boolean literalboolean

More information

プログラミングD - Java

プログラミングD - Java プログラミング D 講義資料 中田明夫 nakata@ist.osaka-u.ac.jp ML 教科書 プログラミング言語 Standard ML 入門 :1,2 章 講義のねらい 関数型プログラムを知る 関数型プログラムを知る利点 プログラムを統一的, 抽象的に捕らえる リスト処理, 高階関数, 再帰関数定義 リストやツリーなどのデータ構造は再帰的に定義 再帰関数で扱うとプログラミングが容易 数学的な裏付け

More information

Functional Programming

Functional Programming PROGRAMMING IN HASKELL プログラミング Haskell Chapter 9 - Interactive Programs 対話プログラム 愛知県立大学情報科学部計算機言語論 ( 山本晋一郎 大久保弘崇 2011 年 ) 講義資料オリジナルは http://www.cs.nott.ac.uk/~gmh/book.html を参照のこと 0 Introduction 8 章まで Haskell

More information

CX-Checker CX-Checker (1)XPath (2)DOM (3) 3 XPath CX-Checker. MISRA-C 62%(79/127) SQMlint 76%(13/17) XPath CX-Checker 3. CX-Checker 4., MISRA-C CX- Ch

CX-Checker CX-Checker (1)XPath (2)DOM (3) 3 XPath CX-Checker. MISRA-C 62%(79/127) SQMlint 76%(13/17) XPath CX-Checker 3. CX-Checker 4., MISRA-C CX- Ch CX-Checker: C 1 1 2 3 4 5 1 CX-Checker CX-Checker XPath DOM 3 CX-Checker MISRA-C CX-Checker: A Customizable Coding Checker for C TOSHINORI OSUKA, 1 TAKASHI KOBAYASHI, 1 JUNICHI MASE, 2 NORITOSHI ATSUMI,

More information

「計算と論理」 Software Foundations その3

「計算と論理」  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 information

r08.dvi

r08.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 information

untitled

untitled Fortran90 ( ) 17 12 29 1 Fortran90 Fortran90 FORTRAN77 Fortran90 1 Fortran90 module 1.1 Windows Windows UNIX Cygwin (http://www.cygwin.com) C\: Install Cygwin f77 emacs latex ps2eps dvips Fortran90 Intel

More information

0 1 1 @master q 3 1.1.......................................... 3 1.2....................................... 4 1.3....................................

0 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 information

ohp08.dvi

ohp08.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 information

2 2.1 NPCMJ ( (Santorini, 2010) (NPCMJ, 2016) (1) (, 2016) (1) (2) (1) ( (IP-MAT (CONJ ) (PP (NP (D ) (N )) (P )) (NP-SBJ *

2 2.1 NPCMJ (  (Santorini, 2010) (NPCMJ, 2016) (1) (, 2016) (1) (2) (1) ( (IP-MAT (CONJ ) (PP (NP (D ) (N )) (P )) (NP-SBJ * Emacs Emacs : Emacs 1 Emacs Emacs ( ) (NPCMJ ) 1 Emacs NPCMJ 2 1 2 2.1 NPCMJ (http://npcmj.ninjal.ac.jp/) (Santorini, 2010) (NPCMJ, 2016) (1) (, 2016) (1) (2) (1) ( (IP-MAT (CONJ ) (PP (NP (D ) (N )) (P

More information

ohp11.dvi

ohp11.dvi 19 11 ( ) 2019.4.20 1 / ( ) n O(n 2 ) O(n 2 ) ( ) 1 d n 1 n logn O(nlogn) n ( n logn C ) 2 ( ) ( merge) 2 1 1 3 1 4 5 4 2 3 7 9 7 1 2 3 4 5 7 9 1: 2 ivec merge 3 ( ) (2) int *ivec_new(int size) { int *a

More information

listings-ext

listings-ext (6) Python (2) ( ) ohsaki@kwansei.ac.jp 5 Python (2) 1 5.1 (statement)........................... 1 5.2 (scope)......................... 11 5.3 (subroutine).................... 14 5 Python (2) Python 5.1

More information

r11.dvi

r11.dvi 19 11 ( ) 2019.4.20 1 / 1.1 ( n n O(n 2 O(n 2 ) ( 1 d n 1 n logn O(nlogn n ( n logn C 1.2 ( ( merge 2 1 1 3 1 4 5 4 2 3 7 9 7 1 2 3 4 5 7 9 1: 2 ivec merge int *ivec_new(int size) { int *a = (int*)malloc((size+1)

More information

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics;

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; 19 3!!...... (+) (>) (++) (+=) for while 3.1!! 3.1.1 50 20 20 5 (20, 20) 3.1.1 (1)(Blocks1.java) public class Blocks1 extends JApplet { public void paint(graphics g){ 5 g.drawrect( 20, 20, 50, 20); g.drawrect(

More information

SML#³«È¯ºÇÁ°Àþ

SML#³«È¯ºÇÁ°Àþ SML# 2011 in Tokyo, 2011/09/17 1 / 34 SML# 2011 in Tokyo, 2011/09/17 1 / 34 SML# 2011 in Tokyo, 2011/09/17 1 / 34 SML# ML 1993 SML# of Kansai 2003 e-society JAIST 2006 SML# 0.10 2011 9 SML# 0.90 2 / 34

More information

slide9.dvi

slide9.dvi - val a = Array.array(20,""); val a = [ "","","","","","","","","","",\ "","",... ] : string array - Array.update(a,5,"abc"); val it = () : unit - Array.sub(a,5); val it = "abc" : string 9-1 - Array.length(a);

More information

2 objective 1 2.1 m a ( ) Haskell Rank2Types 2 newtype Object f g = Object { runobject :: forall a. f a -> g (a, Object f g) } 1 a g a Functor g a ::

2 objective 1 2.1 m a ( ) Haskell Rank2Types 2 newtype Object f g = Object { runobject :: forall a. f a -> g (a, Object f g) } 1 a g a Functor g a :: Haskell 1, 2 fumiexcel@gmail.com 2 IIJ kazu@iij.ad.jp Haskell Haskell Haskell 1 Haskell[1] Haskell [2] Haskell ( OOPL) GUI Haskell Haskell OOPL OOPL [3, 4] ( OOP) [5] OOP Haskell OOPL Haskell Java C++

More information

Pascal Pascal Free Pascal CPad for Pascal Microsoft Windows OS Pascal

Pascal Pascal Free Pascal CPad for Pascal Microsoft Windows OS Pascal Pascal Pascal Pascal Free Pascal CPad for Pascal Microsoft Windows OS 2010 10 1 Pascal 2 1.1.......................... 2 1.2.................. 2 1.3........................ 3 2 4 2.1................................

More information

program.dvi

program.dvi 2001.06.19 1 programming semi ver.1.0 2001.06.19 1 GA SA 2 A 2.1 valuename = value value name = valuename # ; Fig. 1 #-----GA parameter popsize = 200 mutation rate = 0.01 crossover rate = 1.0 generation

More information

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value = Part2-1-3 Java (*) (*).class Java public static final 1 class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value

More information

4 ソフトウェア工学 Software Engineering 抽象データ型 ABSTRACT DATA TYPE データ抽象 (data abstraction) 目的 : データ構造を ( 実装に依存せずに ) 抽象的に定義 方法 : データにアクセス (read, write) する関数の仕様

4 ソフトウェア工学 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 information

shift/reset [13] 2 shift / reset shift reset k call/cc reset shift k shift (...) k 1 + shift(fun k -> 2 * (k 3)) k 2 * (1 + 3) 8 reset shift reset (..

shift/reset [13] 2 shift / reset shift reset k call/cc reset shift k shift (...) k 1 + shift(fun k -> 2 * (k 3)) k 2 * (1 + 3) 8 reset shift reset (.. arisa@pllab.is.ocha.ac.jp asai@is.ocha.ac.jp shift / reset CPS shift / reset CPS CPS 1 [3, 5] goto try/catch raise call/cc [17] control/prompt [8], shift/reset [5] control/prompt, shift/reset call/cc (continuationpassing

More information

text_08.dvi

text_08.dvi C 8 12 6 6 8 Java (3) 1 8.1 8 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 8.2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

More information

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout <<

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout << C++ C C++ 1 C++ C++ C C++ C C++? C C++ C *.c *.cpp C cpp VC C++ 2 C++ C++ C++ [1], C++,,1999 [2],,,2001 [3], ( )( ),,2001 [4] B.W. /D.M.,, C,,1989 C Web [5], http://kumei.ne.jp/c_lang/ 3 Hello World Hello

More information

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) 3 5 14 18 21 23 23 24 28 29 29 31 32 34 35 35 36 38 40 44 44 45 46 49 49 50 pref : 2004/6/5 (11:8) 50 51 52 54 55 56 57 58 59 60 61

More information