Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What is /prog/s opinion of OCAML

Name: Anonymous 2007-07-21 3:24 ID:iW/qroSS

O`Caml.

Name: Anonymous 2007-07-22 17:50 ID:8G+TPm4t

Ocaml has really clean syntax for a statically typed language. It is very clear what is going on the type system helps in debugging. Anyone here is commenting on the superficial and they even get that wrong

let f x = x *. x
let sqr_list l = List.map f l
let sqr_list l = List.map (fun x -> x *. x) l

let rec sqr_list = function
   [] -> []
 | x::xs ->  ( x *. x ) :: sqr_list xs

let sqr_list l =
  let ol = ref [] in
  List.iter (fun x ->
    ol := x :: !ol
  ) l
  List.rev ol

let sqr_list l =
  let ol = ref [] in
  let len = length l in
  for i = 0 to (len - 1) do
    ol := (List.nth l (len - 1 - i)) :: !ol
  done
  ol
;;

So whatever. It all works and you can do the same thing multiple ways in multiple paradigms.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List