unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* slib primes
@ 2009-04-16  0:33 Dan Gildea
       [not found] ` <20090416003353.GA22389-U9BOa8JvqEg/A7J+Bw32uJkQkdDMV+C2@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Gildea @ 2009-04-16  0:33 UTC (permalink / raw)
  To: slib-discuss, guile-devel

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>
ABORT: (wrong-number-of-args)
guile> 
Some deprecated features have been used.  Set the environment
variable GUILE_WARN_DEPRECATED to "detailed" and rerun the
program to get more information.  Set it to "no" to suppress
this message.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: slib primes
       [not found] ` <20090416003353.GA22389-U9BOa8JvqEg/A7J+Bw32uJkQkdDMV+C2@public.gmane.org>
@ 2009-04-16 16:07   ` Aubrey Jaffer
  2009-04-16 22:23     ` Ludovic Courtès
  2009-04-16 22:44     ` [Slib-discuss] " Dan Gildea
  0 siblings, 2 replies; 7+ messages in thread
From: Aubrey Jaffer @ 2009-04-16 16:07 UTC (permalink / raw)
  To: Dan Gildea; +Cc: slib-discuss-mXXj517/zsQ, guile-devel-mXXj517/zsQ

 | Date: Wed, 15 Apr 2009 20:33:53 -0400
 | From: Dan Gildea <gildea-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
 | 
 | 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: slib primes
  2009-04-16 16:07   ` Aubrey Jaffer
@ 2009-04-16 22:23     ` Ludovic Courtès
       [not found]       ` <87y6u0kzk2.fsf-mXXj517/zsQ@public.gmane.org>
  2009-04-16 22:44     ` [Slib-discuss] " Dan Gildea
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2009-04-16 22:23 UTC (permalink / raw)
  To: guile-devel; +Cc: slib-discuss

Hello,

Aubrey Jaffer <agj@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'.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: slib primes
       [not found]       ` <87y6u0kzk2.fsf-mXXj517/zsQ@public.gmane.org>
@ 2009-04-16 22:44         ` Aubrey Jaffer
       [not found]           ` <20090416224421.B9EDC51D7E7-F8W5xzWImdI61HJwdXWPoQ@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Aubrey Jaffer @ 2009-04-16 22:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: slib-discuss-mXXj517/zsQ, guile-devel-mXXj517/zsQ

 | From: ludo-mXXj517/zsQ@public.gmane.org (Ludovic =?iso-8859-1?Q?Court=E8s?=)
 | Date: Fri, 17 Apr 2009 00:23:57 +0200
 | 
 | Hello,
 | 
 | Aubrey Jaffer <agj-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Slib-discuss] slib primes
  2009-04-16 16:07   ` Aubrey Jaffer
  2009-04-16 22:23     ` Ludovic Courtès
@ 2009-04-16 22:44     ` Dan Gildea
       [not found]       ` <20090416224432.GA9551-U9BOa8JvqEg/A7J+Bw32uJkQkdDMV+C2@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Dan Gildea @ 2009-04-16 22:44 UTC (permalink / raw)
  To: Aubrey Jaffer; +Cc: slib-discuss, guile-devel

On Thu, April 16, 2009 at 12:07PM, Aubrey Jaffer wrote:
>  | Date: Wed, 15 Apr 2009 20:33:53 -0400
>  | From: Dan Gildea <gildea@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

Thanks - but I still get the same error when I use either of those
methods.  

Actually, with guile 1.8.6, it seems that I still need to
(use-modules ((ice-9 slib)) after the invocations above;
I think because of the version number test at
the beginning of guile.init.  With guile 1.8.1, the invocations
above work, but I still get the conflict with guile's built-in
list->array.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: slib primes
       [not found]           ` <20090416224421.B9EDC51D7E7-F8W5xzWImdI61HJwdXWPoQ@public.gmane.org>
@ 2009-04-16 23:11             ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2009-04-16 23:11 UTC (permalink / raw)
  To: Aubrey Jaffer; +Cc: slib-discuss-mXXj517/zsQ, guile-devel-mXXj517/zsQ

Aubrey Jaffer <agj-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org> writes:

>  | From: ludo-mXXj517/zsQ@public.gmane.org (Ludovic =?iso-8859-1?Q?Court=E8s?=)
>  | Date: Fri, 17 Apr 2009 00:23:57 +0200
>  | 
>  | Hello,
>  | 
>  | Aubrey Jaffer <agj-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org> 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'.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: slib primes
       [not found]       ` <20090416224432.GA9551-U9BOa8JvqEg/A7J+Bw32uJkQkdDMV+C2@public.gmane.org>
@ 2009-04-17  2:29         ` Aubrey Jaffer
  0 siblings, 0 replies; 7+ messages in thread
From: Aubrey Jaffer @ 2009-04-17  2:29 UTC (permalink / raw)
  To: Dan Gildea; +Cc: slib-discuss-mXXj517/zsQ, guile-devel-mXXj517/zsQ

 | Date: Thu, 16 Apr 2009 18:44:32 -0400
 | From: Dan Gildea <gildea-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
 | 
 | On Thu, April 16, 2009 at 12:07PM, Aubrey Jaffer wrote:
 | >  | Date: Wed, 15 Apr 2009 20:33:53 -0400
 | >  | From: Dan Gildea <gildea-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
 | >  | 
 | >  | 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 <agj-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
In-reply-to: <87od8jjeil.fsf-mXXj517/zsQ@public.gmane.org> (ludo-mXXj517/zsQ@public.gmane.org)
Date: Wed,  9 Apr 2008 20:14:05 -0400 (EDT)

 | From: ludo-mXXj517/zsQ@public.gmane.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-discuss-mXXj517/zsQ@public.gmane.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 -0000	1.69
- --- guile.init	9 Apr 2008 23:23:55 -0000	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 ((idx (+ -1 (car dims)) (+ -1 idx)))
+ 	      ((negative? idx) vect)
+ 	    (ra2v (cdr dims) (cons idx idxs)))))
+     (ra2v dims '())
+     vect))
+ ))
+ 
  (define create-array make-array)
  (define (make-uniform-wrapper prot)
    (if (string? prot) (set! prot (string->number prot)))


_______________________________________________
Slib-discuss mailing list
Slib-discuss-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/slib-discuss
------- End of forwarded message -------

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-17  2:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-16  0:33 slib primes Dan Gildea
     [not found] ` <20090416003353.GA22389-U9BOa8JvqEg/A7J+Bw32uJkQkdDMV+C2@public.gmane.org>
2009-04-16 16:07   ` Aubrey Jaffer
2009-04-16 22:23     ` Ludovic Courtès
     [not found]       ` <87y6u0kzk2.fsf-mXXj517/zsQ@public.gmane.org>
2009-04-16 22:44         ` Aubrey Jaffer
     [not found]           ` <20090416224421.B9EDC51D7E7-F8W5xzWImdI61HJwdXWPoQ@public.gmane.org>
2009-04-16 23:11             ` Ludovic Courtès
2009-04-16 22:44     ` [Slib-discuss] " Dan Gildea
     [not found]       ` <20090416224432.GA9551-U9BOa8JvqEg/A7J+Bw32uJkQkdDMV+C2@public.gmane.org>
2009-04-17  2:29         ` Aubrey Jaffer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).