OCaml

OCaml
패러다임멀티 패러다임: 함수형, 명령형, 모듈성[1], 객체 지향
설계자Xavier Leroy, Jérôme Vouillon, Damien Doligez, Didier Rémy, Ascánder Suárez
개발자INRIA
발표일1996년(30년 전)(1996)[2]
최근 버전5.4.1[3] 위키데이터에서 편집하기
최근 버전 출시일2026년 2월 17일 (3개월 전)
자료형 체계inferred, static, strong, structural
구현 언어OCaml, C
플랫폼IA-32, x86-64, 파워, SPARC, ARM 32-64
운영 체제크로스 플랫폼: 유닉스, macOS, 윈도우
라이선스LGPLv2.1
파일 확장자.ml, .mli
웹사이트ocaml.org
영향을 받은 언어
C, Caml, 모듈라-3, 파스칼, 표준 ML
영향을 준 언어
ATS, Rocq (previously known as Coq), Elm, F#, F*, Haxe, Opa, 러스트,[4] 스칼라, Gleam

OCaml(Objective Caml, /ˈkæməl/)은 ML 언어의 방언인 Caml 프로그래밍 언어의 주요 구현체로서 Xavier Leroy, Jérôme Vouillon, Damien Doligez, Didier Rémy 등의 사람들이 1996년에 작성하였다. OCaml은 INRIA에서 주도적으로 관리하고 유지하는 오픈 소스 프로젝트이다.

OCaml은 Caml 언어의 핵심 부분에 객체 지향 구조를 추가한 것이다.

OCaml의 특징은 정적 타입 시스템, 타입 추론, 파라메트릭 폴리모피즘, 패턴 매칭, 펑터, 예외 처리, 쓰레기 수집 등이다.

Ocaml 도구 모음에는 대화식의 톱 레벨(top level) 인터프리터, 바이트코드 컴파일러, 최적화 컴파일러 등이 포함되어 있다. 또한 많은 표준 라이브러리들이 포함되어 있고 탄탄한 모듈 방식 및 대형 소프트웨어에 적용 가능한 객체 지향 프로그래밍 구조 등을 가지고 있어서, 파이썬이나 과 같은 언어들로 응용 프로그램을 작성해야 하는 경우에 Ocaml도 충분히 유용하게 사용할 수 있다.

Ocaml은 Caml Light를 계승하였다. CAML은 Categorical Abstract Machine Language의 머리글자이지만, Ocaml은 abstract machine(추상 기계) 기능을 삭제하였다.

예제

print_endline "Hello World!"
let rec fib_aux n a b =
  match n with
  | 0 -> a
  | _ -> fib_aux (n - 1) b (a+b)
let fib n = fib_aux n 0 1
let rec qsort = function
   | [] -> []
   | pivot :: rest ->
       let is_less x = x < pivot in
       let left, right = List.partition is_less rest in
       qsort left @ [pivot] @ qsort right

각주

  1. “Modules”. 2020년 2월 22일에 확인함. 
  2. Leroy, Xavier (1996). “Objective Caml 1.00”. caml-list mailing list. 
  3. “OCaml 5.4.1 Release Notes”. 2026년 6월 7일에 확인함. 
  4. “Influences - The Rust Reference”. 《The Rust Reference》. 2023년 12월 31일에 확인함. 

외부 링크

  • OCaml 위키데이터에서 편집하기 - 공식 웹사이트

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.