OCaml
Frå Wikipedia – det frie oppslagsverket
OCaml, eller Objective Caml, er «storebror» til Caml og tilbyr i tillegg til Caml-eigenskapane moglegheit for objektorientert programmering.
Hello World [endre]
ocaml -I +labltk
Objective Caml version 3.09.1
# print_endline "Hello world";;
Hello world
- : unit = ()
# let f = print_endline;;
val f : string -> unit = <fun>
# let g x y = x^" "^y;;
val g : string -> string -> string = <fun>
# let h = g "Hello";;
val h : string -> string = <fun>
# h "world";;
- : string = "Hello world"
# h "kévin";;
- : string = "Hello kévin"
# let (&) f g x = g (f x) ;;
val ( & ) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c = <fun>
# ( h & f ) "world";;
Hello world
- : unit = ()
#load "labltk.cma";;
#open Tk;;
# let _ =
let top = openTk () in
let button = Button.create ~background:`White ~text:"Hello" top in
bind ~events:[`ButtonPress;`KeyPressDetail "Return"]
~action:(fun _ -> print_endline "Hello World")
top;
pack [coe button];
mainLoop()
;;
- : unit = ()
#
| Programmeringsspråk | |
|---|---|
|
ABC | Ada | AFL | Agora | ALGOL | APL | Assembler | awk | B | BASIC | BETA | BLISS | C | C++ | C# | Caml | Cobol | Concurrent C | CSP | D | Delphi | Erlang | Forth | Fortran | Haskell | HyperTalk | Icon| INTERCAL | Java | Lisp | Miranda | ML | Modula | NIAL | Objektorientert C | occam | OCaml | O'Haskell | Pascal | Perl | PHP | Pike | PL/I | Plankalkül | Portal | Prolog | Python | R | Ruby | Scheme | Simula | Sina | Sisa | Smalltalk | SML | SNOBOL | Visual Basic |
|