6-1

Size: px
Start display at page:

Download "6-1"

Transcription

1 6-1

2 (data type) 6-2

3 6-3

4 ML, Haskell, Scala Lisp, Prolog (setq x 123) (+ x 456) (setq x "abc") (+ x 456) ; 6-4

5 ( ) subtype INDEX is INTEGER range ; type DAY is (MON, TUE, WED, THU, FRI, SAT, SUN); subtype WEEKDAY is DAY range MON..FRI; type YEAR is new INTEGER; Java 5 Generics (parameterized types) 6-5

6 Java 5 Generics Java 2 ArrayList Object ArrayList list = new ArrayList(); list.add(new Integer(123)); Integer x = (Integer)list.get(0); /* cast */ Java 5 ArrayList ArrayList<Integer> list = new ArrayList<Integer>(); list.add(new Integer(123)); Integer x = list.get(0); /* cast */ 6-6

7 (primitive types) (enum) (aggregate types) ( struct) ( union) 6-7

8 C Java Java Unicode C if (0 < x < 9) (enum) C Java 5 typesafe 6-8

9 C enum enum day { MON, TUE, WED, THU, FRI, SAT, SUN }; int main() { enum day d; int x; d = SUN; x = SUN; /* */ printf("%d\n", d); /* 6 */ } Java 5 enum Day { MON, TUE, WED, THU, FRI, SAT, SUN }; public static void main(string[] args) { Day d; int x; d = Day.SUN; x = Day.SUN; /* */ System.out.println(d); /* SUN */ } 6-9

10 Pascal type a = array [-5..5] of integer; type b = array [MON..FRI] of integer; C Java C (sizeof ) int a[size]; p = a; /* p = &a[0] */ 6-10

11 C ( ) nul ( \0 ) Java 6-11

12 C (struct) struct t { int i; float f; int a[size]; }; struct t s; struct t *p; s.i = 123; s.a[0] = 456; p = &s; p->i = 123; /* p->i (*p).i */ p->a[0] = 456; 6-12

13 (1) C (union) union t { int i; float f; }; union t u; u.i = 123; printf("%d\n", u.i); printf("%f\n", u.f); /* */ 6-13

14 (2) enum tag { TAG_INT, TAG_FLOAT }; struct t { enum tag tag; union { int i; float f; } value; } s; s.tag = TAG_INT; s.value.i = 123; if (s.tag == TAG_INT) { printf("%d\n", s.value.i); } 6-14

15 (1) Pascal 1 Pascal type COLOR = set of (RED, GREEN, BLUE); var C, C1, C2: COLOR; C1 := [RED,GREEN]; C2 := [GREEN,BLUE]; C := C1 + C2; /* */ C := C1 * C2; /* */ C := C1 - C2; /* */ if RED in C1 then /* */...; 6-15

16 (2) C enum { RED=01, GREEN=02, BLUE=04 }; int c1, c2, c3; c1 = RED GREEN; c2 = GREEN BLUE; c = c1 c2; /* */ c = c1 & c2; /* */ c = c1 & ~c2; /* */ if ((RED & c1)!= 0) /* */...; 6-16

17 (1) Lisp (car x): x (cdr x): x (cons x y): y x 6-17

18 (2) (setq x (a (b c) d)) (car x) ; a (cdr x) ; ((b c) d) (cdr (cdr x)) ; (d) (cdr (cdr (cdr x))) ; () (car (cdr x)) ; (b c) (cons e x) ; (e a (b c) d) (car (cons e x)) ; e (cdr (cons e x)) ; (a (b c) d) 4600 Scheme 6-18

19 C (dangling pointer) char *readline() { char buffer[1000]; fgets(buffer, 1000, stdin); return buffer; } 6-19

20 C Lisp (defun inc (x) (+ x 1)) (mapcar inc (1 2 3)) => (2 3 4) (mapcar (lambda (x) (- x 1)) (1 2 3)) => (0 1 2) Scheme (define (make-func y) (lambda (x) (+ x y))) (define func (make-func 1)) (func 123) =>

21 (1) (monomorphic) (polymorphic) (ad-hoc polymorphism) (generic polymorphism) 6-21

22 (2) (overloading) + (inheritance polymorphism) (subtype) (supertype) 6-22

23 (3) (parametric polymorphism) C++ template Java generics 6-23

24 (1) Java 5 List<Integer> list = new ArrayList<Integer>(); list.add(new Integer(123)); Integer x = list.get(0); /* cast */ Iterator<Integer> iter = list.iterator(); while (iter.hasnext()) { Integer y = iter.next(); /* cast */ } Map<String,Integer> map = new HashMap<String,Integer>(); map.put("abc", new Integer(456)); Integer z = map.get("abc"); 6-24

25 (2) Java 5 class Pair<T1,T2> { T1 first; T2 second; public Pair(T1 f, T2 s) { first = f; second = s; } public T1 first() { return first; } } public T2 second() { return second; } Pair<String,Integer> pair = new Pair<String,Integer>("abc", new Integer(123)); String x = pair.first(); 6-25

26 (1) (encapsulation) C Java public private 6-26

27 (2) push, pop 6-27

????? 1???

????? 1??? SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON

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

Print

Print 2016 5.14 6.3 6.22 7.16 )22 5.14()22() ) 6.3()5() W)26 )18 6.22(W)26() 26( 7.16()18(M) 18(M 2016 V2 0 www.imageforumfestival.com 0 V7 V9 V2 0 11:00 13:45 16:30 19:00 5/14 [sat] 5/15 [sun ] 5/16 [mon

More information

untitled

untitled 2013. Apr.4 Mon Tue Wed Thu Fri Sat Sun 4/1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 5/1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 TEL WEB 1 2 3 4 1 2 3! ENTER 2013. 329 2013.

More information

13koki_koza.indd

13koki_koza.indd Tokyo University of Science Calendar 2013. 10~2014. 3 2013 6 13 20 27 7 14 21 28 1 8 15 22 29 10 Sun Mon Tue Wed Thu Fri Sat 2 9 16 23 30 3 10 17 24 31 4 11 18 25 5 12 19 26 3 10 17 24 4 11 18 25 5 12

More information

0ニ0・モgqNャX1TJf・

0ニ0・モgqNャX1TJf・ 2013 Summer 2012.4.1 >>> 2013.3.31 01 Masayuki Shimada 02 6: 6: 6: 03 SUN SAT FRI THU WED TUE MON 18 17 19 20 22 23 24 21 54 58 45 58 58 54 58 55 25 12 05 54 54 58 27 58 35 54 54 54 6: 5: 04 10: 10:54

More information

Step1 Step2 Step3 Step4 Step5 COLUMN.1 Step1 Step2 Step3 Step4 Step5 Step6 Step7 Step8 COLUMN.2 Step1 Step2 Step3 Step4 Step5 COLUMN.3 Step1 Step2 Ste

Step1 Step2 Step3 Step4 Step5 COLUMN.1 Step1 Step2 Step3 Step4 Step5 Step6 Step7 Step8 COLUMN.2 Step1 Step2 Step3 Step4 Step5 COLUMN.3 Step1 Step2 Ste 2 0 1 2 C A L E N D A R 7 8 9 SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT 1 2 3 4 5 6 7 1 2 3 4 8 9 10 11 12 13 14 5 6 7 8 9 10 11 15 16 17 18 19 20 21 12 13 14

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

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

JAVA とテンプレート

JAVA とテンプレート JAVA とテンプレート 序論 : コンテナ 他のクラスのオブジェクトを保存するものをコンテナ (Container) と呼ぶ 集合 リスト 表 コンテナに求められる機能 追加 削除 参照 要素の比較 並べ替え 要素のクラスが不明では 比較できない 要素が想定しているクラスのものかの判定 テンプレート以前の対応方法 コンテナ設計時に 保存されるクラスを特定してコンテナをコードする 保存されるクラスごとに作成しなければならない

More information

C01-C04

C01-C04 1 January 20 21 22 23 24 25 26 27 28 29 30 31 sun mon tue wed thu fri s a t sun mon tue wed thu fri s a t 13 14 15 16 1 January 17 18 19 sun mon tue wed thu fri s a t sun mon tue wed thu fri s a t 13 20

More information

r3.dvi

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

Microsoft PowerPoint L07-Imperative Programming Languages students

Microsoft PowerPoint L07-Imperative Programming Languages students プログラミング言語論 A (Concepts on Programming Languages) 趙建軍 (Jianjun Zhao) 1 第 7 回 命令型言語 (3) (Imperative Programming Languages) データ型 ( 命令型言語が持つデータ構造について解説する ) 2018.05.24 2 1 講義内容 (Outline) データ構造 データ型 (data type)

More information

広報ひめじ2013年6月号

広報ひめじ2013年6月号 黒 田 官 兵 衛 人 と 生 涯 2 黒 田 官 兵 衛 人 と 生 涯 2 黒 田 官 兵 衛 人 と 生 涯 2 織 田 に 味 方 せ よ 信 長 か ら 名 刀 授 か る 織 田 に 味 方 せ よ 信 長 か ら 名 刀 授 か る 織 田 に 味 方 せ よ 信 長 か ら 名 刀 授 か る Mon Tue Wed Thu Fri Sat Sun 3

More information

Java (7) Lesson = (1) 1 m 3 /s m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3

Java (7) Lesson = (1) 1 m 3 /s m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3 Java (7) 2008-05-20 1 Lesson 5 1.1 5 3 = (1) 1 m 3 /s 1 2 3 10 m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3 1.2 java 2 1. 2. 3. 4. 3 2 1.3 i =1, 2, 3 V i (t) 1 t h i (t) i F, k

More information

Java (5) 1 Lesson 3: x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java , 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flow

Java (5) 1 Lesson 3: x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java , 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) flow Java (5) 1 Lesson 3: 2008-05-20 2 x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java 1.1 10 10 0 1.0 2.0, 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flowrate.dat" 10 8 6 4 2 0 0 5 10 15 20 25 time (s) 1 1

More information

<955C8E862E6169>

<955C8E862E6169> JAPAN INTERNATIONAL CONTENTS FESTIVAL 9/30 TUE 10/1 WED 2 THU 3 FRI 4 SAT 5 SUN 6 MON 7 TUE 8 WED 9 THU 10 FRI 11 SAT 12 SUN 13 MON 14 TUE 2008 / EVENT MAP 15 WED 16 THU 17 FRI 18 SAT 19 SUN 20 MON 21

More information

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

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

.....Q.........\..A

.....Q.........\..A Osaka University of Commerce vol.01 2009 July 4. ( 2. ( 6. ( 5. ( 3. ( 1. ( ! 5 1 8 9 5 1 8 9 11 4 8 5 13 20 27 10 7 14 28 6 10 20 18 17 7 1 8 15 22 30 11 4 25 1 13 20 2 12 13 910 282 1923 1723 12 2 9

More information

: : : TSTank 2

: : : TSTank 2 Java (8) 2008-05-20 Lesson6 Lesson5 Java 1 Lesson 6: TSTank1, TSTank2, TSTank3 java 2 car1 car2 Car car1 = new Car(); Car car2 = new Car(); car1.setcolor(red); car2.setcolor(blue); car2.changeengine(jet);

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

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

r3.dvi

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

T OPICS 1 5.3 1430 1500 1700 6.2 1830 1900 T OPICS 4.16 1330 1400 6.4 1730 1800 1845 6.23 1815 1900 5.5 5.4 1430 1500 1615 1215 1300 1415 1515 TEL 011

T OPICS 1 5.3 1430 1500 1700 6.2 1830 1900 T OPICS 4.16 1330 1400 6.4 1730 1800 1845 6.23 1815 1900 5.5 5.4 1430 1500 1615 1215 1300 1415 1515 TEL 011 2016. 1 2 3 2016 4 5 SAPPORO CONCERT HALLPERFORMANCE CALENDAR 2016. 5 3 5 5 tue thu 1 2 3 5 3 SAPPORO CONCERT HALLPERFORMANCE CALENDAR 5 tue thu 5 2016 4 5 T OPICS 1 5.3 1430 1500 1700 6.2 1830 1900 T

More information

„‰“⁄†Fno.8-01.pdf

„‰“⁄†Fno.8-01.pdf Contents No.8 2006.October Takeo Public Relations Magazine 2 TAKEO Public Relations 3 TAKEO Public Relations 4 TAKEO Public Relations TAKEO Public Relations 6 7 TAKEO Public Relations 8 TAKEO Public Relations

More information

Microsoft Word - keisankigairon.ch doc

Microsoft Word - keisankigairon.ch doc 1000000100001010 1000001000001011 0100001100010010 1010001100001100 load %r1,10 load %r2,11 add %r3,%r1,%r2 store %r3,12 k = i + j ; = > (* 1 2 3 4 5 6 7 8 9 10) 3628800 DO 3 I=1,3 DO3I=1.3 DO3I 1.3

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

(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

ALG ppt

ALG ppt 2012 7 5 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html (198 ) f(p) p 2 1 2 f 2 53 12 41 69 11 2 84 28 31 63 97 58 76 19 91 88 53 69 69 11 84 84 63

More information

文字列操作と正規表現

文字列操作と正規表現 文字列操作と正規表現 オブジェクト指向プログラミング特論 2018 年度只木進一 : 工学系研究科 2 文字列と文字列クラス 0 個以上の長さの文字の列 Java では String クラス 操作 文字列を作る 連結する 文字列中に文字列を探す 文字列中の文字列を置き換える 部分文字列を得る 3 String クラス 文字列を保持するクラス 文字列は定数であることに注意 比較に注意 == : オブジェクトとしての同等性

More information

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

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 information

目 め 隠 か く し 陶 と う 芸 げ い の 心 こころ 旅 た び の 巻 ま き 闇 の 中 に 見 えてくるイメージを 形 に キッズゴルファーへの 道 の 巻 週 末 体 験 くらぶの 夏 休 み 期 間 中 の 予 定 です 週 末 体 験 くらぶの 夏 休 み 期 間 中 の 予 定 です 8 SUN MON TUE WED THU FRI SAT 2 3 4 5 6

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

@(h) Select.vb ver 1.1 ( 07.09.15 ) @(h) Select.vb ver 1.0 ( 07.09.13 ) @(s) Option Explicit Private Structure SYMBOLINFO Dim SyDataType As String Dim

@(h) Select.vb ver 1.1 ( 07.09.15 ) @(h) Select.vb ver 1.0 ( 07.09.13 ) @(s) Option Explicit Private Structure SYMBOLINFO Dim SyDataType As String Dim A HotDocument A HotDocument A HotDocument A HotDocument A HotDocument A HotDocument A HotDocument A HotDocument @(h) Select.vb ver 1.1 ( 07.09.15 ) @(h) Select.vb ver 1.0 ( 07.09.13 ) @(s) Option Explicit

More information

ニュース10-11月号

ニュース10-11月号 2 TOKYO NATIONAL MUSEUM NEWS 8 1201 3PICK UP DATA 1250 1081212 1300 1,5001,200 1,200900 900600 20 1 03-5777-8600 http:// todaiji2010.jp/ 10 8 200 1121121 3 EVENT 12 13 12 13 12 13 3 10301330151161330153

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

01 02 03 04 05 06 12 14 20 23 26 28 01 02 03 04 05 06 07 08 09 10 11 12 13 14 10:30-11:20 K-01 13:00-14:00 K-02 14:30-15:30 K-04 16:00-17:00 K-06 AD-01 AD-02 14:00-17:00 AD-03 11:00-15:00 SP-01 13:00-14:00

More information

VB.NETコーディング標準

VB.NETコーディング標準 (C) Copyright 2002 Java ( ) VB.NET C# AS-IS extremeprogramming-jp@objectclub.esm.co.jp bata@gold.ocn.ne.jp Copyright (c) 2000,2001 Eiwa System Management, Inc. Object Club Kenji Hiranabe02/09/26 Copyright

More information

コンパイラ演習 第 7 回

コンパイラ演習 第 7 回 コンパイラ演習 第 7 回 (2010/11/18) 秋山茂樹池尻拓朗前田俊行鈴木友博渡邊裕貴潮田資秀小酒井隆広山下諒蔵佐藤春旗大山恵弘佐藤秀明住井英二郎 今日の内容 Type Polymorphism ( 型多相性 ) の実現について Polymorphism 大きく分けて 3 種類ある Parametric polymorphism Subtyping polymorphism Ad-hoc polymorphism

More information

導入基礎演習.ppt

導入基礎演習.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 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

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

新・明解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

1.3 ( ) ( ) C

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

untitled

untitled August. 2013 No.114 Contents INDEX opics T! 6.8 SAT 6.9 SUN THU 5.30 FRI 5.17 Aizawa Event Calendar 8 August 8.27 TUE TUE sat 130016:00 9.10 8.24 SAT 9.21 SAT 8.31 sat - 9.14 sun 15 5 12 19 26 6 13 20

More information

{:from => Java, :to => Ruby } Java Ruby KAKUTANI Shintaro; Eiwa System Management, Inc.; a strong Ruby proponent http://kakutani.com http://www.amazon.co.jp/o/asin/4873113202/kakutani-22 http://www.amazon.co.jp/o/asin/477413256x/kakutani-22

More information

ALG ppt

ALG ppt 2012 6 21 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 1 l l O(1) l l l 2 (123 ) l l l l () l H(k) = k mod n (k:, n: ) l l 3 4 public class MyHashtable

More information

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A Java 3 p.1 3 Java Java if for while C 3.1 if Java if C if if ( ) 1 if ( ) 1 else 2 1 1 2 2 1, 2 { Q 3.1.1 1. int n = 2; if (n

More information

Microsoft PowerPoint - PLT3.ppt

Microsoft PowerPoint - PLT3.ppt プログラミング言語論 第 3 回状態モデルと命令型言語 (2) データ型 担当 : 犬塚 今日の講義 データ型に関する事柄を見る 変数を確保する時期静的 / 動的変数 データ型 基本データ型 ユーザ定義 ( 構造 ) データ型 データ型と集合の対応 データ型と制御構造の対応 抽象データ型 オブジェクト 1 2 変数領域を確保する時期 コンパイルの際 static variable 実行時間効率がよい

More information

untitled

untitled 2011 6 20 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2011/index.html tech.ac.jp/k1sakai/lecture/alg/2011/index.html html 1 O(1) O(1) 2 (123) () H(k) = k mod n

More information

明解Javaによるアルゴリズムとデータ構造

明解Javaによるアルゴリズムとデータ構造 21 algorithm List 1-1 a, b, c max Scanner Column 1-1 List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); Chap01/Max3.java

More information

10K pdf

10K pdf #1 #2 Java class Circle { double x; // x double y; // y double radius; // void set(double tx, double ty){ x = tx; y = ty; void set(double tx, double ty, double r) { x = tx; y = ty; radius = r; // Circle

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

5 p Point int Java p Point Point p; p = new Point(); Point instance, p Point int 2 Point Point p = new Point(); p.x = 1; p.y = 2;

5 p Point int Java p Point Point p; p = new Point(); Point instance, p Point int 2 Point Point p = new Point(); p.x = 1; p.y = 2; 5 p.1 5 JPanel (toy example) 5.1 2 extends : Object java.lang.object extends... extends Object Point.java 1 public class Point { // public int x; public int y; Point x y 5.1.1, 5 p.2 5 5.2 Point int Java

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

‚æ4›ñ

‚æ4›ñ ( ) ( ) ( ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 (OUS) 9 26 1 / 28 ( ) ( ) ( ) A B C D Z a b c d z 0 1 2 9 (OUS) 9

More information

PowerPoint Presentation

PowerPoint Presentation UML 2004 7 9 10 ... OOP UML 10 Copyright 2004 Akira HIRASAWA all rights reserved. 2 1. 2. 3. 4. UML 5. Copyright 2004 Akira HIRASAWA all rights reserved. 3 1..... Copyright 2004 Akira HIRASAWA all rights

More information

ex12.dvi

ex12.dvi 1 0. C, char., char, 0,. C, ("),., char str[]="abc" ; str abc.,, str 4. str 3. char str[10]="abc" ;, str 10, str 3., char s[]="abc", t[10] ;, t = s. ASCII, 0x00 0x7F, char., "abc" 3, 1. 1 8 256, 2., 2

More information

Microsoft PowerPoint ppt

Microsoft PowerPoint ppt 独習 Java ( 第 3 版 ) 6.7 変数の修飾子 6.8 コンストラクタの修飾子 6.9 メソッドの修飾子 6.10 Object クラスと Class クラス 6.7 変数の修飾子 (1/3) 変数宣言の直前に指定できる修飾子 全部で 7 種類ある キーワード final private protected public static transient volatile 意味定数として使える変数同じクラスのコードからしかアクセスできない変数サブクラスまたは同じパッケージ内のコードからしかアクセスできない変数他のクラスからアクセスできる変数インスタンス変数ではない変数クラスの永続的な状態の一部ではない変数不意に値が変更されることがある変数

More information

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >=

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >= II 14 2018 7 26 : : proen@mm.ics.saitama-u.ac.jp 14,, 8 2 12:00 1 O(1) n O(n) O(log n) O(1) 32 : 1G int 4 250 M 2.5 int 21 2 0 100 0 100 #include #define HASHSIZE 100 /* */ #define NOTFOUND 0

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

tuat1.dvi

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

Vector Vector Vector Vector() Vector(int n) n Vector(int n,int delta) n delta

Vector Vector Vector Vector() Vector(int n) n Vector(int n,int delta) n delta Java VectorEnumeration Stack Hashtable StringTokenizer Vector Vector Vector Vector() Vector(int n) n Vector(int n,int delta) n delta Vector Vector void addelement(object obj) int capacity() Object clone()

More information

ALG2012-A.ppt

ALG2012-A.ppt 21279 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/212/index.html (, )ε m = n C2 = n ( n 1) / 2 m = n ( n 1) 1 11 11 111 11 111 111 1111 1 1 11 1 11 11 111 4-dimentional

More information

アルゴリズムとデータ構造1

アルゴリズムとデータ構造1 1 2007 6 26 26 (sakai.keiichi@kochi sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2007/index.html tech.ac.jp/k1sakai/lecture/alg/2007/index.html FIFO (46 ) head,

More information

デジタル表現論・第4回

デジタル表現論・第4回 デジタル表現論 第 4 回 劉雪峰 ( リュウシュウフォン ) 2016 年 5 月 2 日 劉 雪峰 ( リュウシュウフォン ) デジタル表現論 第 4 回 2016 年 5 月 2 日 1 / 14 本日の目標 Java プログラミングの基礎 出力の復習 メソッドの定義と使用 劉 雪峰 ( リュウシュウフォン ) デジタル表現論 第 4 回 2016 年 5 月 2 日 2 / 14 出力 Systemoutprint()

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

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225 Java Java Java Java Java 4 p35 4-2 * *** ***** *** * Unix p36 4-3 a,b,c,d 100,200,250,500 a*b = 20000 a*b+c = 20250 a*b+c*d = 145000 (a+b)*(c+d) = 225000 a+b*c+d = 50600 b/a+d/c = 4 p38 4-4 (1) mul = 1

More information

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1 Java (9) 1 Lesson 7 2008-05-20 Java System.out.println() 1 Java API 1 Java Java 1 GUI 2 Java 3 1.1 5 3 1.0 10.0, 1.0, 0.5 5.0, 3.0, 0.3 4.0, 1.0, 0.6 1 2 4 3, ( 2 3 2 1.2 Java (stream) 4 1 a 5 (End of

More information

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

. IDE JIVE[1][] Eclipse Java ( 1) Java Platform Debugger Architecture [5] 3. Eclipse GUI JIVE 3.1 Eclipse ( ) 1 JIVE Java [3] IDE c 016 Information Pr

. IDE JIVE[1][] Eclipse Java ( 1) Java Platform Debugger Architecture [5] 3. Eclipse GUI JIVE 3.1 Eclipse ( ) 1 JIVE Java [3] IDE c 016 Information Pr Eclipse 1,a) 1,b) 1,c) ( IDE) IDE Graphical User Interface( GUI) GUI GUI IDE View Eclipse Development of Eclipse Plug-in to present an Object Diagram to Debug Environment Kubota Yoshihiko 1,a) Yamazaki

More information

O(N) ( ) log 2 N

O(N) ( ) log 2 N 2005 11 21 1 1.1 2 O(N) () log 2 N 1.2 2 1 List 3-1 List 3-3 List 3-4? 3 3.1 3.1.1 List 2-1(p.70) 1 1 10 1 3.1.2 List 3-1(p.70-71) 1 1 2 1 2 2 1: 1 3 3.1.3 1 List 3-1(p.70-71) 2 #include stdlib.h

More information

Java学習教材

Java学習教材 Java 2016/4/17 Java 1 Java1 : 280 : (2010/1/29) ISBN-10: 4798120987 ISBN-13: 978-4798120980 2010/1/29 1 Java 1 Java Java Java class FirstExample { public static void main(string[] args) { System.out.println("

More information

exec.dvi

exec.dvi 2018 c 6, Mini-C C++ 6211 611, 61, print,,, (run ),,, (int ), 7, x, x "a" 3 "b" 4 "x" 10 (, ), x STL map 1 + 2, 1 2,, x = ;, 1, 2 x { 1 ; 2 ; ; m, if ( ) { 1 else { 2, 1,, 2 0, 1, 3 0, 2,,, main 6 1 ,,

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

oop1

oop1 public class Car{ int num; double gas; // double distance; String maker; // // // void drive(){ System.out.println(""); Car.java void curve(){ System.out.println(""); void stop(){ System.out.println("");

More information

untitled

untitled INDEX April. 2013 No.113 Contents 2.20 WED 2.16 SAT T opics! Aizawa Event Calendar 5 May TUE 5.14 TUE 5.28 TUE 6.11 6 13 20 27 5 12 19 26 7 14 21 28 1 8 15 22 29 2 9 16 23 30 3 10 17 24 31 4 11 18 25 MON

More information

RubyKaigi2009 COBOL

RubyKaigi2009 COBOL RubyKaigi2009 COBOL seki@druby.org 3360 Pragmatic Bookshelf druby Web $32.00 International Journal of PARALLEL PROGRAMING !? MapReduce Rinda (map, reduce) map reduce key value [, ] [, ID] map()

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

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

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

tkk0408nari

tkk0408nari SQLStatement Class Sql Database SQL Structured Query Language( ) ISO JIS http://www.techscore.com/tech/sql/02_02.html Database sql Perl Java SQL ( ) create table tu_data ( id integer not null, -- id aid

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

大容量情報検索論

大容量情報検索論 リスト構造 プログラミング演習 Ⅱ (9) 中村, 小松, 菊池 1. List 構造 配列 データが並んでいるデータ構造 静的 ( 配列長を後から変更できない ) リスト構造 次のデータを示す で構成される. 動的 ( 配列長を変更可能 ) 0 1 2 データ 次 データ 次 A[0] A[1] A[2] 10 30 データ 次 null 20 List クラスの例 ListNames.pde ListNames.pde

More information

新・明解C言語 ポインタ完全攻略

新・明解C言語 ポインタ完全攻略 2 1-1 1-1 /* 1-1 */ 1 int n = 100; int *p = &n; printf(" n %d\n", n); /* n int */ printf("*&n %d\n", *&n); /* *&n int */ printf(" p %p\n", p); /* p int * */ printf("&*p %p\n", &*p); /* &*p int * */ printf("sizeof(n)

More information

Java プログラミング Ⅰ 3 回目変数 変数 変 数 一時的に値を記憶させておく機能型 ( データ型 ) と識別子をもつ 2 型 ( データ型 ) 変数の種類型に応じて記憶できる値の種類や範囲が決まる 型 値の種類 値の範囲 boolean 真偽値 true / false char 2バイト文

Java プログラミング Ⅰ 3 回目変数 変数 変 数 一時的に値を記憶させておく機能型 ( データ型 ) と識別子をもつ 2 型 ( データ型 ) 変数の種類型に応じて記憶できる値の種類や範囲が決まる 型 値の種類 値の範囲 boolean 真偽値 true / false char 2バイト文 Java プログラミング Ⅰ 3 回目変数 変数 変 数 一時的に値を記憶させておく機能型 ( データ型 ) と識別子をもつ 2 型 ( データ型 ) 変数の種類型に応じて記憶できる値の種類や範囲が決まる 型 値の種類 値の範囲 boolean 真偽値 true / false char 2バイト文字 0x0000 ~ 0xffff byte 1バイト整数 - 2 8 ~ 2 8-1 short 2バイト整数

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

やさしい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

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

untitled

untitled 21174 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/211/index.html tech.ac.jp/k1sakai/lecture/alg/211/index.html html (, )ε m = n C2 = n ( n 1) / 2 m = n ( ( n

More information

6 月 号 2008 No.44 人 と 自 然 が 輝 く 高 原 のまちづくり http://www.jinsekigun.jp/ 3 4 T O P I C S & N E W S JINSEKIKOUGEN 5 油 木 高 校 J o u r n a l 神 石 高 原 町 観 光 ガイド 6 85-2711 87-0199 84-2022 82-0005 詳 しくは 地 域 子 育 て

More information

新・明解Javaで学ぶアルゴリズムとデータ構造

新・明解Javaで学ぶアルゴリズムとデータ構造 第 1 章 基本的 1 n 21 1-1 三値 最大値 algorithm List 1-1 a, b, c max // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); List 1-1 System.out.println("");

More information

オブジェクト脳のつくり方

オブジェクト脳のつくり方 2003 12 16 ( ) ML Java,.NET, UML J2EE, Web Java, J2EE.NET SI ex. ) OO OO OO OO OO (Controller) (Promoter) (Analyzer) (Supporter) http://nba.nikkeibp.co.jp/coachsp.html It takes time. OO OK OO 1.

More information

Java演習(4) -- 変数と型 --

Java演習(4)   -- 変数と型 -- 50 20 20 5 (20, 20) O 50 100 150 200 250 300 350 x (reserved 50 100 y 50 20 20 5 (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; (reserved public class Blocks1 extends

More information

1

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

More information