slide9.dvi
|
|
- とき てっちがわら
- 5 years ago
- Views:
Transcription
1 - 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
2 - Array.length(a); val it = 20 : int - Array.maxLen; val it = : int - val a=array.fromlist [#"a",#"b",#"c"]; val a=[ #"a",#"b",#"c" ] : char array 9-2
3 0 9 - local val seed = (Random.rand (0,1)) in fun randomint() = (Random.randInt seed) mod 10 end; val randomint = fn : unit -> int - val ar = Array.tabulate (10, fn m=>randomint()); val ar = [ 0,5,1,3,9,7,5,2,6,6 ] : int \ array 9-3
4 swap(ar,i,j): ar[i] ar[j] - fun swap (ar,i,j) = let val iv = Array.sub(ar,i) in (Array.update (ar,i,array.sub(ar,j)); Array.update(ar,j,iv)) end; val swap = fn : a array * int * int -> \ unit - ar; swap(ar,3,5); ar; val ar = [ 0,5,1,3,9,7,5,2,6,6 ] : int \ array val it = () : unit val it = [ 0,5,1,7,9,3,5,2,6,6 ] : int \ array 9-4
5 partition(ar,p,a,b): a b p fun partition (ar,p,a,b) = let val av = Array.sub(ar,a); val bv = Array.sub(ar,b) in case (b<=a, av<=p, p<bv) of (true, _, _ ) => if av<=p then a else a-1 ( _, true, _ ) => partition (ar,p,a+1,b) ( _, _, true) => partition (ar,p,a,b-1) ( _, _, _ ) => (swap(ar,a,b); partition(ar,p,a+1,b-1)) end 9-5
6 fun qsort (ar,i,j) = if j <= i then () else let val pivot = Array.sub(ar,i); val k = partition(ar,pivot,i+1,j); val _ = swap(ar,i,k); in (qsort (ar,i,k-1); qsort (ar,k+1,j)) end fun sort (ar) = qsort (ar, 0, Array.length(ar)-1); - sort(ar); ar; val it = () : unit val it = [ 0,1,2,3,5,5,6,6,7,9 ] : int \ array 9-6
7 - - TextIO.inputLine; val it = fn : TextIO.instream -> string \ option - - TextIO.StreamIO.inputLine; val it = fn :?.TextIO.instream -> (st\ ring *?.TextIO.instream) option 9-7
8 ( ) - TextIO TEXT_IO - signature X = TEXT_IO; signature TEXT_IO = sig type vector = string type elem = char type instream type outstream val stdin : instream val stdout : outstream val stderr : outstream val print : string -> unit 9-8
9 - - print "abc\n"; abc val it = () : unit - - str; val it = fn : char -> string - Real.toString; val it = fn : real -> string - Int.toString; val it = fn : int -> string - Bool.toString; val it = fn : bool -> string 9-9
10 ( ) - - TextIO.stdOut; val it = - : TextIO.outstream - TextIO.stdErr; val it = - : TextIO.outstream - output 1 output1 - TextIO.output(TextIO.stdOut, "abc\n"); abc val it = () : unit - TextIO.output1(TextIO.stdOut, #"A"); Aval it = () : unit 9-10
11 - - TextIO.openOut; val it = fn : string -> TextIO.outstream - TextIO.openAppend; val it = fn : string -> TextIO.outstream - TextIO.openIn; val it = fn : string -> TextIO.instream - - TextIO.flushOut; val it = fn : TextIO.outstream -> unit 9-11
12 ( ) - - TextIO.closeOut; val it = fn : TextIO.outstream -> unit - TextIO.closeIn; val it = fn : TextIO.instream -> unit 9-12
13 - - TextIO.inputLine(TextIO.stdIn); abc val it = SOME "abc\n" : string option - (elem char vector string ) - TextIO.input1; val it = fn : TextIO.instream -> TextIO\.elem option - TextIO.inputN; val it = fn : TextIO.instream * int -> \ TextIO.vector - TextIO.inputLine; val it = fn : TextIO.instream -> string\ option 9-13
14 ( ) - - TextIO.lookahead; val it = fn : TextIO.instream -> TextI\ O.elem option - - TextIO.endOfStream; val it = fn : TextIO.instream -> bool 9-14
15 - structure S=TextIO.StreamIO; structure S : TEXT_STREAM_IO? - S.inputLine; val it = fn :?.TextIO.instream -> (st\ ring *?.TextIO.instream) option - tmp.txt abc def 9-15
16 ( ) - - val st = TextIO.getInstream(TextIO.o\ penin("tmp.txt")); val st = - :?.TextIO.instream - val SOME (a,st1) = S.inputLine(st); val a = SOME "abc\n" : string val st1 = - :?.TextIO.instream - val SOME (a,st2) = S.inputLine(st1); val a = SOME "def\n" : string val st2 = - :?.TextIO.instream - S.inputLine(st1); val it = SOME ("def\n",-) : (string * \?.TextIO.instream) option 9-16
17 OS (OS.FileSys ) signature OS_FILE_SYS = sig type dirstream val opendir : string -> dirstream val readdir : dirstream -> string val closedir : dirstream -> unit val chdir : string -> unit val getdir : unit -> string val mkdir : string -> unit val rmdir : string -> unit val islink : string -> bool val readlink : string -> string val fullpath : string -> string val realpath : string -> string val modtime : string -> Time.time val settime : string * Time.time option -> unit end 9-17
18 ( ) - getdir: - structure F=OS.FileSys; structure F : OS_FILEOS_FILE_SYSSYS - F.getDir(); val it = "/home/s/lecture" : string - realpath: - F.realPath "./side1.c"; val it = "side1.c" : string - fullpath: - F.fullPath "./side1.c"; val it = "/home/s/lecture/side1.c"\ : string 9-18
19 ( ) - modtime: (1970 ) - F.modTime "side1.c"; val it = TIME {sec= ,usec=0} \ : Time.time - Date.fromTimeLocal it; val it = DATE {day=15,hour=12,isdst=some false, minute=51,month=dec,offset=none, second=1,wday=fri,yday=348, year=2006} : Date.date 9-19
20 ( ) - - F.setTime ("xx", SOME(Time.now()) ); val it = () : unit - F.modTime "xx"; val it = TIME {sec= ,usec=0} :\ Time.time 9-20
21 ( ) - opendir: - val dir = F.openDir(F.getDir()); val dir = DS {dirstrm=-,isopen=ref true}\ :?.OS_FileSys.dirstream - readdir: - F.readDir dir; val it = "gofer.tex" : string - F.readDir dir; val it = "automaton" : string 9-21
22 (OS.Path ) (OS ) signature OS_PATH = sig val parentarc : string val currentarc : string val validvolume : {isabs:bool, vol:string} -> bool val fromstring : string -> {arcs:string list, isabs:bool, vol:string} val tostring : {arcs:string list, isabs:bool, vol:string} -> string val getvolume : string -> string val getparent : string -> string val splitdirfile : string -> {dir:string, file:string} val joindirfile : {dir:string, file:string} -> string val splitbaseext : string -> {base:string, ext:string option} val joinbaseext : {base:string, ext:string option} -> string val isabsolute : string -> bool val isrelative : string -> bool val isroot : string -> bool end 9-22
23 ( ) - - structure P=OS.Path; structure P : OS_PATH - P.fromString("/home/s/lecture"); val it = {arcs=["home","s","lecture"], isabs=true,vol=""} : {arcs:string list, isabs:bool, vol:string} - P.toString it; val it = "/home/s/lecture" : string - P.getParent it; val it = "/home/s" : string isabs: vol: 9-23
24 ( ) - - P.splitDirFile "/home/s/side1.c"; val it = {dir="/home/s",file="side1.c"} : {dir:string, file:string} - P.joinDirFile it; val it = "/home/s/side1.c" : string - - P.splitBaseExt "side1.c"; val it = {base="side1",ext=some "c"} : {base:string, ext:string option} - P.joinBaseExt it; val it = "side1.c" : string 9-24
25 (Unix ) signature UNIX = sig type proc val executeinenv : string * string list * string list -> proc val execute : string * string list -> proc val streamsof : proc -> TextIO.instream * TextIO.outstream val reap : proc ->?.POSIX_Process.exit_status val kill : proc *?.POSIX_Signal.signal -> unit end 9-25
26 ( ) - structure U=Unix; structure U : UNIX - val p=u.execute("/bin/ls",[]); val p = PROC {ins=-,outs=-,pid=pid 599}\ : Unix.proc - val (inst,outst)= U.streamsOf p; val inst = - : TextIO.instream val outst = - : TextIO.outstream - TextIO.inputAll(inst); val it = "automaton\ngofer.dvi#" : \ TextIO.vector - U.reap p; val it = W_EXITED :?.POSIX_Process.exi\ t_status 9-26
27 - fun (name: string, args: string list) = ( ; OS.Process.success ); name: args:
28 ( ) - SMLofNJ.exportFn: - fun check (x, args) = = (print (x ^ "\n"); = map (fn x=> print (x ^ "\n")) args; = OS.Process.success); val check = fn : string * string list -> OS.Process.status - SMLofNJ.exportFn; val it = fn : string * (string * string \ list -> OS.Process.status) -> unit - SMLofNJ.exportFn("check",check); Process sml finished check.x86-bsd 9-28
29 ( ) - Fri21> 1 ab /usr/local/bin/sml 1 ab 9-29
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 informationSML#³«È¯ºÇÁ°Àþ
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 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 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
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# 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 informationMicrosoft PowerPoint - lectureNote6.ppt
i217 関 数 プログラミング 第 6 回 レコードと 組 二 木 厚 吉 緒 方 和 博 レコード(1) いくつかの 値 v 1,,v n をひとまとめにしたデータで, 各 値 v i には 互 いに 異 なるラベルl i が 割 当 てられる. {l 1 = v 1,,l n = v n } このレコードの 型 は, 各 viの 型 をt i とすると, {l 1 :t 1,,l n :t n
More informationObjective Caml 3.12 Jacques Garrigue ( ) with Alain Frisch (Lexifi), OCaml developper team (INRIA)
Objective Caml 3.12 Jacques Garrigue ( ) http://www.math.nagoya-u.ac.jp/~garrigue/ with Alain Frisch (Lexifi), OCaml developper team (INRIA) Jacques Garrigue Modules in Objective Caml 3.12 1 Objective
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 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 informationorg/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 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 information11夏特集号初校.indd
1 2 3 5 50 40 7 6 3 ABC 3 5 A 5% B C 100 3 1 2 3 A 5% 5% 5% B 10% 5% 0% C 20% 10% 15% A 15.8% 15.0% 0.8% B 15.5% 15.0% 0.5% C 12.2% 15.0% 2.8% 2,000 1,500 1,000 500 0 10% 5% 3% 1% 01 5 10 15 20 25 30
More information-1 - -2 - -3 - -4-2000 -5 - -6 - -7 - -8 - -9 - - 10 - -11-60 200 2,000 1980 24-12 - - 13 - - 14 - - 15 - - 16 - - 17 - 1998 '98 593'98.4. 604'99.3. 1998 '98.10.10 11 80 '98.11. 81'99.3. 49 '98.11. 50
More informationプログラミングD - Java
プログラミング D 講義資料 中田明夫 nakata@ist.osaka-u.ac.jp ML 教科書 プログラミング言語 Standard ML 入門 :1,2 章 講義のねらい 関数型プログラムを知る 関数型プログラムを知る利点 プログラムを統一的, 抽象的に捕らえる リスト処理, 高階関数, 再帰関数定義 リストやツリーなどのデータ構造は再帰的に定義 再帰関数で扱うとプログラミングが容易 数学的な裏付け
More informationPascal 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 informationMCMD Ruby Package Documentation NYSOL : Ver. 1.0 revise history: March 10, 2014 : nysol November 2, 2013 : first release 2014 3 10 Copyright c 2013 by NYSOL CORPORATION 3 1 5 1.1.....................................................
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 informationML λ λ 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 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 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 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 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 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 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 informationA/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B
A/B (2018/10/19) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 10 19 A/B 1 2018 10 19 2 1 1 1.1 OHP.................................... 1
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 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 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 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 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, 1. x 2 1 = (x 1)(x + 1) x 3 1 = (x 1)(x 2 + x + 1). a 2 b 2 = (a b)(a + b) a 3 b 3 = (a b)(a 2 + ab + b 2 ) 2 2, 2.. x a b b 2. b {( 2 a } b )2 1 =
x n 1 1.,,.,. 2..... 4 = 2 2 12 = 2 2 3 6 = 2 3 14 = 2 7 8 = 2 2 2 15 = 3 5 9 = 3 3 16 = 2 2 2 2 10 = 2 5 18 = 2 3 3 2, 3, 5, 7, 11, 13, 17, 19.,, 2,.,.,.,?.,,. 1 , 1. x 2 1 = (x 1)(x + 1) x 3 1 = (x 1)(x
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 informationex01.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 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 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 informationA/B (2018/06/08) Ver kurino/2018/soft/soft.html A/B
A/B (2018/06/08) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 6 8 A/B 1 2018 6 8 2 1 1 1.1 OHP.................................... 1 1.2
More informationWindows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2
September 2016 1 Windows Cygwin Mac *1 Emacs Ruby 1 1.1 ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2 ~/16:00:20> ls 2 2 ls ls -a ~/16:00:20> ls -a
More informationslide6.pptx
ソフトウェア工学入門 第 6 回コマンド作成 2 ファイルシステム 今後のスケジュール 5/28. コマンド作成 2 ( 本日 ) 6/4. ファイルシステム プロセス ハードウェア 6/11. 第 2 回個別試験 grep プログラム 1 次のプログラムを作成し grep.c という名前で保存しなさい #include #include #include
More information離散数理工学 第 2回 数え上げの基礎:漸化式の立て方
2 okamotoy@uec.ac.jp 2015 10 20 2015 10 18 15:29 ( ) (2) 2015 10 20 1 / 45 ( ) 1 (10/6) ( ) (10/13) 2 (10/20) 3 ( ) (10/27) (11/3) 4 ( ) (11/10) 5 (11/17) 6 (11/24) 7 (12/1) 8 (12/8) ( ) (2) 2015 10 20
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¥×¥í¥°¥é¥ß¥ó¥°±é½¬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 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 informationプログラミングD - Java
プログラミング D ML 大阪大学基礎工学部情報科学科中田明夫 nakata@ist.osaka-u.ac.jp 教科書 プログラミング言語 Standard ML 入門 1,2 章 講義のねらい 関数型プログラムを知る 関数型プログラムの特徴 利点 : 数学的な裏づけ プログラムの正しさの証明が容易 リスト処理, 高階関数, 再帰関数定義 リストやツリーなどのデータ構造は再帰的に定義 再帰関数で扱うとプログラミングが容易
More informationuntitled
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情報科学概論 第1回資料
1. Excel (C) Hiroshi Pen Fujimori 1 2. (Excel) 2.1 Excel : 2.2Excel Excel (C) Hiroshi Pen Fujimori 2 256 (IV) :C (C 65536 B4 :2 (2 A3 Excel (C) Hiroshi Pen Fujimori 3 Tips: (1) B3 (2) (*1) (3) (4)Word
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 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 informationexec.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コンピュータ概論
4.1 For Check Point 1. For 2. 4.1.1 For (For) For = To Step (Next) 4.1.1 Next 4.1.1 4.1.2 1 i 10 For Next Cells(i,1) Cells(1, 1) Cells(2, 1) Cells(10, 1) 4.1.2 50 1. 2 1 10 3. 0 360 10 sin() 4.1.2 For
More informationex01.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 informationr03.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 informationJEB Plugin 開発チュートリアル 第4回
Japan Computer Emergency Response Team Coordination Center 電子署名者 : Japan Computer Emergency Response Team Coordination Center DN : c=jp, st=tokyo, l=chiyoda-ku, email=office@jpcert.or.jp, o=japan Computer
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 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 informationEmacs Ruby..
command line editor 27014533 2018 3 1 5 1.1................................... 5 1.2................................... 5 2 6 2.1 Emacs...................................... 6 2.2 Ruby.......................................
More informationohp03.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 information2002.N.x.h.L.......g9/20
1 2 3 4 5 6 1 2 3 4 5 8 9 1 11 11 12 13 k 14 l 16 m 17 n 18 o 19 k 2 l 2 m 21 n 21 o 22 p 23 q 23 r 24 24 25 26 27 28 k 28 l 29 m 29 3 31 34 42 44 1, 8, 6, 4, 2, 1,2 1, 8 6 4 2 1, 8, 6, 4, 2, 1,2 1, 8
More informationML 演習 第 4 回
ML 演習第 4 回 おおいわ Mar 6, 2003 今回の内容 補足 Ocaml のモジュールシステム structure signature functor Ocaml コンパイラの利用 2 識別子について 利用可能文字 先頭文字 : A~Z, a~z, _ ( 小文字扱い ) 2 文字目以降 : A~Z, a~z, 0~9, _, 先頭の文字の case で 2 つに区別 小文字 : 変数,
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 information̤Äê
SNS 1, IT.,.,.,., SNS,,,..,,.,,,.,.,,. 2 1 6 1.1................................................ 6 1.2................................................ 6 1.3...............................................
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 informationxl 1 program Othello6; 2 {$APPTYPE CONSOLE} 3 uses SysUtils; 4 5 type 6 TMasuNo = 0..99; // 7 TYouso = (Soto,Kara,Kuro,Siro); // 8 TBan = array [TMasu
xl 1 program Othello6; 2 {$APPTYPE CONSOLE 3 uses SysUtils; 4 5 type 6 TMasuNo = 0..99; // 7 TYouso = (Soto,Kara,Kuro,Siro); // 8 TBan = array [TMasuNo] of TYouso; // 10 10 9 TPlayer = Kuro..Siro; // 10
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 informationQuick Sort 計算機アルゴリズム特論 :2017 年度 只木進一
Quick Sort 計算機アルゴリズム特論 :2017 年度 只木進一 2 基本的考え方 リスト ( あるいは配列 )SS の中の ある要素 xx(pivot) を選択 xx より小さい要素からなる部分リスト SS 1 xx より大きい要素からなる部分リスト SS 2 xx は SS 1 または SS 2 に含まれる 長さが 1 になるまで繰り返す pivot xx の選び方として 中央の要素を選択すると効率が良い
More informationInt 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 informationALG 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 informationuntitled
ST0001-1- -2- -3- -4- BorderStyle ControlBox, MinButton, MaxButton True False True False Top Left Height,Width Caption Icon True/False -5- Basic Command1 Click MsgBox " " Command1 Click Command1 Click
More informationuntitled
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 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 informationvoid 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第Ⅰ章
4 11 () () () () () () () () () 19 () () () () () () () () () 28 () () 30 32 34 36 37-1 - -2 - () -3 - SPSS () ()() () () () -4 - N N N -5 - () A AB B O () A AB B O N N -6 - -7 - () N= -8 - () () () -9
More information小学女子CL
3km 2015/08/22 10:00 10:18 3km 3(1km*3) 1 8 8 8:12.9 0.0 2 13 13 8:38.0 +25.1 3 9 9 8:51.9 +39.0 4 5 5 8:54.7 +41.8 5 4 4 8:56.4 +43.5 6 1 1 9:34.8 +1:21.9 7 18 18 10:09.9 +1:57.0 8 10 10 10:36.4 +2:23.5
More information3360 druby Web Who is translating it? http://dx.doi.org/10.1007/s10766-008-0086-1 $32.00 International Journal of PARALLEL PROGRAMING Must buy! http://dx.doi.org/10.1007/s10766-008-0086-1 toruby The
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 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 informationtuat2.dvi
( 2 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 7 7 ( 2 ) 1 / 54 (1) (2) (?) (1) (2) 2 ( 2 ) 2 / 54 1. 30 2. 2012 6 30 25 OS ( 2 ) 3 / 54 10 20 1993 1996 2000 2003 = 30 ( 2 ) 4 / 54 1 2 2 ( 2 ) 5 /
More informationA
A 3 2017 4 24 1 1 1.1.......................................... 1 1.2................................ 1 1.2.1................................ 1 1.2.2............................. 1 1.2.3................................
More informationJava プログラミング Ⅰ 7 回目 switch 文と論理演算子 条件判断文 3 switch 文 switch 文式が case の値と一致した場合 そこから直後の break; までを処理し どれにも一致しない場合 default; から直後の break; までを処理する 但し 式や値 1
Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 条件判断文 3 switch 文 switch 文式が case の値と一致した場合 そこから直後の までを処理し どれにも一致しない場合 default; から直後の までを処理する 但し 式や値 1 値 2は整数または文字である switch( 式 ) case 値 1: // コロン : です セミコロン ; と間違えないように!!
More informationJava演習(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取扱説明書 基本ガイド
2 A G B C D E F H I J K L M N L B C A D F A B C D E G H I Fn F1 F2 F1 Fn F2 F3 F4 Windows TPM Fn Fn F7 F10 F2 F A X 0120-873029 (06)6905-5067 (06)6905-5079
More information2.2 Sage I 11 factor Sage Sage exit quit 1 sage : exit 2 Exiting Sage ( CPU time 0m0.06s, Wall time 2m8.71 s). 2.2 Sage Python Sage 1. Sage.sage 2. sa
I 2017 11 1 SageMath SageMath( Sage ) Sage Python Sage Python Sage Maxima Maxima Sage Sage Sage Linux, Mac, Windows *1 2 Sage Sage 4 1. ( sage CUI) 2. Sage ( sage.sage ) 3. Sage ( notebook() ) 4. Sage
More information1 2 3 4 5 6 X Y ABC A ABC B 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 13 18 30 P331 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 ( ) 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
More information26 2 3 4 5 8 9 6 7 2 3 4 5 2 6 7 3 8 9 3 0 4 2 4 3 4 4 5 6 5 7 6 2 2 A B C ABC 8 9 6 3 3 4 4 20 2 6 2 2 3 3 4 4 5 5 22 6 6 7 7 23 6 2 2 3 3 4 4 24 2 2 3 3 4 4 25 6 2 2 3 3 4 4 26 2 2 3 3 27 6 4 4 5 5
More informationmogiJugyo_slide_full.dvi
a 2 + b 2 = c 2 (a, b, c) a 2 a 2 = a a a 1/ 78 2/ 78 3/ 78 4/ 78 180 5/ 78 http://www.kaijo.ed.jp/ 6/ 78 a, b, c ABC C a b B c A C 90 a 2 + b 2 = c 2 7/ 78 C a b a 2 +b 2 = c 2 B c A a 2 a a 2 = a a 8/
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 informationmyx_backup Ver 1.10のPHP7対応
myx_backup Ver 1.10 の PHP7 対応 Published JJ1RLWon by 2016-05-03 (445 閲覧 ) XOOPS Cube の日頃のメンテナンスで使っているモジュールの myx_backup Ver 1.10 の PHP7 への対応お得意の ちょっとだけ改造 自前で行っています mysql 拡張から mysqli 拡張へ変更するため set_magic_quotes_runtime
More informationEPSON VP-1200 取扱説明書
4020178-01 w p s 2 p 3 4 5 6 7 8 p s s s p 9 p A B p C 10 D p E 11 F G H H 12 p G I s 13 p s A D p B 14 C D E 15 F s p G 16 A B p 17 18 s p s 19 p 20 21 22 A B 23 A B C 24 A B 25 26 p s p s 27 28 p s p
More informationFor_Beginners_CAPL.indd
CAPL Vector Japan Co., Ltd. 目次 1 CAPL 03 2 CAPL 03 3 CAPL 03 4 CAPL 04 4.1 CAPL 4.2 CAPL 4.3 07 5 CAPL 08 5.1 CANoe 5.2 CANalyzer 6 CAPL 10 7 CAPL 11 7.1 CAPL 7.2 CAPL 7.3 CAPL 7.4 CAPL 16 7.5 18 8 CAPL
More informationML 演習 第 4 回
ML 演習第 4 回 佐藤春旗, 山下諒蔵, 前田俊行 2006/06/20 ICFP Programming Contest 過去の O'Caml プログラムの実績 1998: 2 位 (ENS Camlist, France) 1999: 1 位 (Camls R Us, O'Caml 作者グループ ) 2000: 1 位 (PLClub, U-Penn, 米澤研住井, 細谷参加 ) 2 位 (Camls
More information2005 D Pascal CASL ( ) Pascal C 3. A A Pascal TA TA TA
2005 D 1 1.1 1.2 Pascal CASL ( ) Pascal 1. 2005 10 13 2006 1 19 12 2. C 3. A A 2 1 2 Pascal 1.3 1. 2. TA TA TA sdate@ist.osaka-u.ac.jp nakamoto@image.med.osaka-u.ac.jp h-kido@ist.osaka-u.ac.jp m-nakata@ist.osaka-u.ac.jp
More information1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l
C/C++ 2007 6 18 1 C STL(1) 2 1.1............................................... 2 1.2 stdio................................................ 3 1.3.......................................... 10 2 11 2.1 sizeof......................................
More informationmstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )
2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test
More information