[ create a new paste ] login | about

Link: http://codepad.org/VU4NgIMz    [ raw code | output | fork ]

OCaml, pasted on Nov 4:
1
2
3
4
5
6
7
8
9
10
11
12
13
open Batteries_uni

let get_list n r =
  let process_coord (x,y) =
    let fx,fy = (float x, float y) in
    let base_angle = atan2 fy fx in
    let delta_angle = r /. (sqrt (fx*.fx +. fy*.fy)) |> asin in
    [(base_angle -. delta_angle, 1); (base_angle +. delta_angle, -1)] |> List.enum in
  let coords_enum = [? (x, y) | x <- 0 -- n; y <- 0 -- x ; x *x + y*y < n * n; x * x + y * y>0 ?] in
  coords_enum |> Enum.map process_coord |> Enum.concat |> List.of_enum |> List.sort;;


let () = (get_list 100 0.02) |> List.length |> Printf.fprintf stdout "%d";;


Output:
1
2
Line 9, characters 21-22:
Syntax error


Create a new paste based on this one


Comments: