mplisp

miniPicoLisp with FFI and modules for Buddy BDD library, OpenGL, Gtk and GMP
git clone https://logand.com/git/mplisp.git/
Log | Files | Refs

gmp-test.l (304B)


      1 # http://paste.lisp.org/display/15116
      2 
      3 (setq X (mpz_new))
      4 (setq Y (mpz_new))
      5 
      6 (mpz_init X)
      7 (mpz_init Y)
      8 
      9 (mpz_set_ui X 0)
     10 (mpz_set_ui Y 1)
     11 
     12 (setq Z (mpz_new))
     13 
     14 (for (N 2 (<= N 1000000) (inc N))
     15    (mpz_init Z)
     16    (mpz_add Z X Y)
     17    (mpz_set X Y)
     18    (mpz_set Y Z)
     19    (mpz_clear Z))
     20 
     21 (mpz_print Y)
     22 (prinl)