Seblog

ML make counter program 본문

Study

ML make counter program

Sebien 2011. 5. 3. 22:23
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.



fun make_counter(init:int) =
let
val count = ref init;
fun counter(inc:int)
=(count = !count +inc;
 !count)
in
counter
end

val c = make_counter(1);
c(2) + c(2) = ?

'Study' 카테고리의 다른 글

Dijkstra Algorithm을 이용한 지하철 최단경로 구하기  (0) 2011.07.09
Block, Scope, first-class  (0) 2011.05.10
Upward Downward Funarg problem  (0) 2011.05.03
문제 유형  (0) 2011.05.02
lambda calculus : binding variable, bound variable  (0) 2011.03.30
Comments