This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

much more efficient



Thanks to Roland Kaufmann.  It's a little harder to figure out what it
is now, but still better than the original. :)

#!/usr/local/bin/guile -s
!#
(define(x b e n)(let((l modulo))(if(= e 1)(l b n)(if(= e 0)1(let((h(x b
(quotient e 2)n)))(if(even? e)(l(* h h)n)(l(* h h b)n)))))))(apply(lambda(e n)
(let l()(let((b(read)))(if(not(eof-object? b))(begin(write(x b e n))(newline)
(l))))))(map string->number(cdr(command-line))))