3. 함수형 언어 LISP Common Lisp, Scheme, Clojure ML SML, nML, Ocaml, F# Etc. Haskell, Erlang
4. 함수형 언어 람다 대수(lambda calculus) f(x) = x+10 (λx.x+10) (λx.x+10) 32 = 32 + 10 = 42 (λop.λx.(op x x)) (+) 21 = (λx.((+) x x)) 21 = (+) 21 21 = 42 부수 효과(side-effect) 함수 실행이 외부에 끼치는 영향. 순수 함수형 언어는 부수효과가 전혀 없다.
5. 함수형 언어 재귀 (Recursion) 불변값(Immutable Value) 고차원 함수 (High-Order Function) 함수를 다루는 함수 타입 추론 (Type Inference) ML류의 언어
6. F#History F# 1.0.1 2005년, SDK For VS2003 OCaml을 .NET으로 F# 2.0 2010년, VS2010 First Class Language .NET Language
7. F# Basic F# Interactive Interpreter Interactive Development F# Tutorial VS2010 에서 Tutorial Project 생성 <demo>
8. F# Syntax let 함수나 값을 정의 let x = 42let z : string = nulllet F x y = x + ylet F (x,y) = x + y
9. F# Syntax fun 무명함수(람다) 정의 let nums = [1; 2; 3;]let odds =List.filter (fun x -> x%2 = 1) numslet oddsSquare = List.map (fun x -> x * x) (List.filter (fun x-> x%2 = 1 ) nums)
10. F# Syntax |> 파이프 연산자. let odds =nums |> List.filter (fun x -> x%2 = 1)let oddsSquare =nums |> List.filter (fun x -> x%2 = 1) |> List.map (fun x -> x*x) 별거 아닌거 같지만 상당히 가독성을 높여준다.
11. F# Syntax Discriminated Union type Shape = | Rect of Point * Point | Ellipse of Point * Point | Comp of Shape * Shape
12. F# Syntax Pattern Match let AreaOf shape = match shape with | Rect(pf, pt) -> rectArea(pf,pt) | Ellipse(pf,pt) -> ellipseArea(pf,pt) | Comp(Rect(p1,p2), Rect(p3,p4)) when isNested(p3,p4,p1,p2) -> rectArea(p1,p2) | Comp(s1,s2) -> let area1 = shapeArea(s1) let area2 = shapeArea(s2) area1 + area2 – (intersectArea(s1,s2))