[表示 : 全て 最新50 1-99 101- 201- 2chのread.cgiへ]
Update time : 05/09 13:36 / Filesize : 85 KB / Number-of Response : 282
[このスレッドの書き込みを削除する]
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧] [類似スレッド一覧]


↑キャッシュ検索、類似スレ動作を修正しました、ご迷惑をお掛けしました

純粋関数型言語Concurent Clean



188 名前:デフォルトの名無しさん mailto:sage [2005/10/25(火) 23:17:03 ]
// haskellの真似 とか調べたことでも書いてみる
foldrWithReadline:: !(String a-> a) a !*File -> (a, *File)
foldrWithReadline proc knil file
#! (end,file) = fend file
| end = (knil, file)
#! (line, file) = freadline file
# (lines , file) = foldrWithReadline proc knil file
= ((proc (trimNewline line) lines), file)
foldrWithReader:: !(*File->(Bool,a,*File)) !(a b->b) b !*File -> (b, *File)
foldrWithReader reader proc knil file
#! (ok, token, file) = reader file
| not ok = (knil, file)
# (tokens , file) = foldrWithReader reader proc knil file
= ((proc token tokens), file)
foldrWithReadChar:: !(Char a-> a) !a !*File -> (a, *File)
foldrWithReadChar x y z = foldrWithReader freadc x y z

readFile :: !String *World -> ([String],*World)
readFile path wld = callWithInputFile path
(\x -> abort ("readFile :: " +++ path ))
(foldrWithReadline (\x y -> [x:y]) []) wld

readFileChar :: !String *World -> ([Char],*World)
readFileChar path wld = callWithInputFile path
(\x -> abort ("readFileChar :: " +++ path))
(foldrWithReadChar (\x y -> [x:y]) []) wld







[ 続きを読む ] / [ 携帯版 ]

全部読む 前100 次100 最新50 [ このスレをブックマーク! 携帯に送る ] 2chのread.cgiへ
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧](*・∀・)<85KB

read.cgi ver5.27 [feat.BBS2 +1.6] / e.0.2 (02/09/03) / eucaly.net products.
担当:undef