open Printf

let rec fig x y l = 
  let lineto = printf "l %.1f %.1f " in
  if l < 3. then (        (* deseneaza patrat *)
    printf "M %.1f %.1f " x y;        (* pozitioneaza cursorul *)
    lineto l 0.;
    lineto 0. l;
    lineto (-.l) 0.;
    lineto 0. (-.l)
  )
  else (                (* 5 figuri de latura l/3 *)
    fig x y (l /. 3.);
    fig (x +. 2.*.l/.3.) y (l /. 3.);
    fig (x +. l/.3.) (y +. l/.3.) (l /. 3.);
    fig x (y +. 2.*.l/.3.)(l /. 3.);
    fig (x +. 2.*.l/.3.) (y +. 2.*.l/.3.) (l /. 3.)
  )
;;

let () = (
  print_string "<?xml version=\"1.0\"?>\n\
  <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n\
  <path d=\"";
  fig 0. 0. 729.;
  print_string "\"/>\n</svg>"
)

This document was generated using caml2html