From: Timothy J. H. <tim...@ma...> - 2005-03-31 14:13:36
|
Hi Geoffrey, The Printf package from sharksoft you linked to is quite nice! http://sharkysoft.com/software/java/lava3/printf/ Just to double check that JScheme was working with that package I ran the following example from their documentation page: > > for (int i = 3; i <= 20000; i *= 3) > Printf.out > ( "(%5d, %6.2f, %#10x)\n", > new Object[] > { new Integer(i), > new Float((float) Math.sqrt((double) i)), > new Integer(i * i) > } > ); Which translates in to JScheme pretty easily ... > tim% java -jar jscheme.jar > JScheme 7.2 (3/7/05 2:23 PM) http://jscheme.sourceforge.net > > (load "elf/classpath.scm") > $1 = #t > > > (addClasspathUrl "lava3-core.jar") > $2 = #null > > > (addClasspathUrl "lava3-printf.jar") > $3 = #null > > > (import "com.sharkysoft.printf.Printf") > $4 = #t > > > (define (for n N by L) > (if (> n N) #f > (begin (L n) (for (+ n by) N by L)))) > $5 = (lambda for (n N by L)...) > > > (for 3 20000 3 (lambda(i) > (Printf.out "(%5d, %6.2f, %#10x)\n" > (list->array Object.class (list i > (.floatValue (Math.sqrt i)) (* i i) > ))))) > ( 3, 1.73, 0x9) > ( 6, 2.45, 0x24) > ( 9, 3.00, 0x51) > ( 12, 3.46, 0x90) > ( 15, 3.87, 0xe1) > ( 18, 4.24, 0x144) > ( 21, 4.58, 0x1b9) > ( 24, 4.90, 0x240) > ( 27, 5.20, 0x2d9) |