Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.51 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. module Tools
  2. open System
  3.  
  4. let sqr x = float(x * x) (* Square two ints into a float *)
  5.  
  6. (* Remove element where predicate *)
  7. let rec remove l predicate =  
  8.     match l with
  9.     | [] -> []
  10.     | hd::tl -> if predicate(hd) then
  11.                     (remove tl predicate)
  12.                  else
  13.                      hd::(remove tl predicate)
  14.  
  15. let loadMap path =
  16.     IO.File.ReadAllText(path).Split(';')
  17.         |> Array.filter(fun s -> s<> String.Empty)
  18.         |> Array.map(fun s-> Int32.Parse(s.Replace(";",String.Empty)))