compile-file works expression-by-expression

2009-04-16 Thread Andy Wingo
Hey folks,

Compile-file now reads and compiles expressions one at a time. This
means that an eval-when can affect the current language or current
reader -- though we currently only use the current language's reader,
the current-reader fluid is ignored. Ludovic, want to give it a poke? :)

Gitk master for great justice,

Andy
-- 
http://wingolog.org/




Re: slib primes

2009-04-16 Thread Ludovic Courtès
Hello,

Aubrey Jaffer a...@alum.mit.edu writes:

 (use-modules (ice-9 slib)) is archaic and doesn't work anymore.

What makes you say so?  It's supposed to work (info (guile) SLIB).
The module was fixed (see `ice-9/ChangeLog-2008' entry dated 2007-10-02)
and the doc was updated for Guile 1.8.3 (tested with SLIB 3a3).

Thanks,
Ludo'.





Re: [Slib-discuss] Re: slib primes

2009-04-16 Thread Ludovic Courtès
Aubrey Jaffer a...@alum.mit.edu writes:

  | From: l...@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=)
  | Date: Fri, 17 Apr 2009 00:23:57 +0200
  | 
  | Hello,
  | 
  | Aubrey Jaffer a...@alum.mit.edu writes:
  | 
  |  (use-modules (ice-9 slib)) is archaic and doesn't work anymore.
  | 
  | What makes you say so?  It's supposed to work (info (guile) SLIB).
  | The module was fixed (see `ice-9/ChangeLog-2008' entry dated 2007-10-02)
  | and the doc was updated for Guile 1.8.3 (tested with SLIB 3a3).

 SLIB-3a3 was released over 3 years ago;

Has `guile.init' changed since then?

For the record, since Guile 1.8.3 `(ice-9 slib)' does almost nothing:

  http://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/slib.scm

It proved to be sufficient back then:

  http://lists.gnu.org/archive/html/guile-devel/2007-08/msg00016.html

Thanks,
Ludo'.




Re: [Slib-discuss] slib primes

2009-04-16 Thread Aubrey Jaffer
 | Date: Wed, 15 Apr 2009 20:33:53 -0400
 | From: Dan Gildea gil...@pobox.com
 | 
 | bash-3.2$ guile-1.8
 | guile (version)
 | 1.8.6
 | guile (use-modules (ice-9 slib))
 | guile *slib-version*
 | 3b1
 | guile (require 'primes)
 | ERROR: Wrong number of arguments to #primitive-procedure list-array

(use-modules (ice-9 slib)) is archaic and doesn't work anymore.

On Unix systems, slib guile will run Guile with SLIB.

Otherwise, set SCHEME_LIBRARY_PATH to the SLIB(3b1) directory.  Then:

  guile -l ${SCHEME_LIBRARY_PATH}guile.init




Re: [Slib-discuss] Re: slib primes

2009-04-16 Thread Aubrey Jaffer
 | From: l...@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=)
 | Date: Fri, 17 Apr 2009 00:23:57 +0200
 | 
 | Hello,
 | 
 | Aubrey Jaffer a...@alum.mit.edu writes:
 | 
 |  (use-modules (ice-9 slib)) is archaic and doesn't work anymore.
 | 
 | What makes you say so?  It's supposed to work (info (guile) SLIB).
 | The module was fixed (see `ice-9/ChangeLog-2008' entry dated 2007-10-02)
 | and the doc was updated for Guile 1.8.3 (tested with SLIB 3a3).

SLIB-3a3 was released over 3 years ago; SLIB-3b1 was a major revision
from SLIB-3a5 in 2008.  SLIB-3a3 is no longer supported.

I don't control Guile documentation.  Its unfortunate that it
references a very out-of-date SLIB.




Re: [Slib-discuss] slib primes

2009-04-16 Thread Aubrey Jaffer
 | Date: Thu, 16 Apr 2009 18:44:32 -0400
 | From: Dan Gildea gil...@pobox.com
 | 
 | On Thu, April 16, 2009 at 12:07PM, Aubrey Jaffer wrote:
 |   | Date: Wed, 15 Apr 2009 20:33:53 -0400
 |   | From: Dan Gildea gil...@pobox.com
 |   | 
 |   | bash-3.2$ guile-1.8
 |   | guile (version)
 |   | 1.8.6
 |   | guile (use-modules (ice-9 slib))
 |   | guile *slib-version*
 |   | 3b1
 |   | guile (require 'primes)
 |   | ERROR: Wrong number of arguments to #primitive-procedure list-array

Use-modules doesn't work on my development machine; but that's not
your problem.  The list-array issue was addressed last year, but I
haven't made a release since then.  The following message includes a
patch to fix the problem.

--- Start of forwarded message ---
From: Aubrey Jaffer a...@alum.mit.edu
In-reply-to: 87od8jjeil@gnu.org (l...@gnu.org)
Date: Wed,  9 Apr 2008 20:14:05 -0400 (EDT)

 | From: l...@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=)
 | Date: Wed, 09 Apr 2008 16:20:50 +0200
 | 
 | SLIB's `array' module (and possibly others) from SLIB 3b1 appears
 | to be partly inaccessible from Guile 1.8 as reported here:
 | 
 |   http://permalink.gmane.org/gmane.lisp.guile.user/6527
 | 
 | Any idea what to look for?

  In /home/ludo/soft/lib/slib/byte.scm:
61: 6  [list-array 1 #u32(32) (0 0 1 1 0 1 0 1 0 ...)]

  /home/ludo/soft/lib/slib/byte.scm:61:3: In procedure list-array in 
expression (list-array 1 (A:fixN8b) ...):
  /home/ludo/soft/lib/slib/byte.scm:61:3: Wrong number of arguments to 
#primitive-procedure list-array

Guile-1.8.1's list-array takes two arguments; but it should take
three (see http://srfi.schemers.org/srfi-63/srfi-63.html or
http://swiss.csail.mit.edu/~jaffer/slib_7.html#SEC193 )

  guile (array-list (list-array 2 '((0 1) (1 4
  ((0 1) (1 4))

  guile (array-list (list-array 2 '#() '((0 1) (1 4

  Backtrace:
  In standard input:
 8: 0* [array-list ...
 8: 1*  [list-array 2 #() ((0 1) (1 4))]

  standard input:8:14: In procedure list-array in expression (list-array 2 
(begin #) ...):
  standard input:8:14: Wrong number of arguments to #primitive-procedure 
list-array
  ABORT: (wrong-number-of-args)

Appended is a patch which corrects list-array, as well as providing
missing array-vector and vector-array.

Thanks for your bug report.  The development version is updated:
http://groups.csail.mit.edu/mac/ftpdir/users/jaffer/slib.zip

Also, the CVS repository is updated:
https://savannah.gnu.org/cvs/?group=slib

 | Thanks,
 | Ludovic.
 ...
 | ___
 | Slib-discuss mailing list
 | slib-disc...@gnu.org
 | http://lists.gnu.org/mailman/listinfo/slib-discuss

Index: guile.init
===
RCS file: /cvsroot/slib/slib/guile.init,v
retrieving revision 1.69
retrieving revision 1.70
diff -c -r1.69 -r1.70
*** guile.init  25 Feb 2008 20:59:56 -  1.69
- --- guile.init9 Apr 2008 23:23:55 -   1.70
***
*** 559,564 
- --- 559,620 
  (if (string=? (scheme-implementation-version) 1.8)
  (module-replace! (current-module) '(make-array)))
  
+ (cond
+  ((string=? (scheme-implementation-version) 1.8.1)
+ (define (list-array rank proto lst)
+   (define dimensions
+ (do ((shp '() (cons (length row) shp))
+(row lst (car lst))
+(rnk (+ -1 rank) (+ -1 rnk)))
+   ((negative? rnk) (reverse shp
+   (let ((nra (apply make-array proto dimensions)))
+ (define (l2ra dims idxs row)
+   (cond ((null? dims)
+(apply array-set! nra row (reverse idxs)))
+   ((if (not (eqv? (car dims) (length row)))
+(slib:error 'list-array
+'non-rectangular 'array dims dimensions))
+(do ((idx 0 (+ 1 idx))
+ (row row (cdr row)))
+((= idx (car dims)))
+  (l2ra (cdr dims) (cons idx idxs) (car row))
+ (l2ra dimensions '() lst)
+ nra))
+ ))
+ 
+ (cond
+  ((not (defined? 'vector-array))
+ (define (vector-array vect prototype . dimensions)
+   (define vdx (vector-length vect))
+   (if (not (eqv? vdx (apply * dimensions)))
+   (slib:error 'vector-array vdx ' (cons '* dimensions)))
+   (let ((ra (apply make-array prototype dimensions)))
+ (define (v2ra dims idxs)
+   (cond ((null? dims)
+(set! vdx (+ -1 vdx))
+(apply array-set! ra (vector-ref vect vdx) (reverse idxs)))
+   (else
+(do ((idx (+ -1 (car dims)) (+ -1 idx)))
+((negative? idx) vect)
+  (v2ra (cdr dims) (cons idx idxs))
+ (v2ra dimensions '())
+ ra))
+ (define (array-vector ra)
+   (define dims (array-dimensions ra))
+   (let* ((vdx (apply * dims))
+(vect (make-vector vdx)))
+ (define (ra2v dims idxs)
+   (if (null? dims)
+ (let ((val (apply array-ref ra (reverse idxs
+   (set! vdx (+ -1 vdx))
+   (vector-set! vect vdx val))
+ (do