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

What is your magnum opus?

Name: Anonymous 2009-04-13 12:57

I created a Scheme LISP compiler that assembles to machine code in x86 format. What have you guys done that many people use today?

Name: Anonymous 2009-04-15 3:19

My attempt at the hybrid version:


(*let fibs n =
  let rec fibq fkm1 fkm2 k n =
    if (n<2) then (if (n=0) then 0 else 1)
    else if (n=k) then (fkm1+fkm2)
         else fibq (fkm1+fkm2) fkm1 (k+1) n
  in fibq 1 0 2 n*)

(*#load "nums.cma";;*)

open Big_int;;

let fibs_big n =
  let rec fibq fkm1 fkm2 k n =
    if (n<2) then (if (n=0) then big_int_of_int(0) else big_int_of_int(1))
    else if (n=k) then (add_big_int fkm1 fkm2)
         else fibq (add_big_int fkm1 fkm2) fkm1 (k+1) n
  in fibq (big_int_of_int(1)) (big_int_of_int(0)) 2 n;;

let f10_8 = string_of_big_int (fibs_big 1000000);;

print_endline f10_8;
flush stdout


It actually runs in a reasonable amount of time, but something like 10**10 is very slow due to the amount of memory needed to represents the bignums as >>50 stated

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