From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Aubrey Jaffer Newsgroups: gmane.lisp.scheme.slib.discuss,gmane.lisp.guile.devel Subject: Re: slib primes Date: Thu, 16 Apr 2009 22:29:18 -0400 (EDT) Message-ID: <20090417022918.D9C4651D7E7@voluntocracy.org> References: <20090416003353.GA22389@f9beta1.cs.rochester.edu> <20090416160727.59A3951D7E7@voluntocracy.org> <20090416224432.GA9551@f9beta1.cs.rochester.edu> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1239935410 1081 80.91.229.12 (17 Apr 2009 02:30:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Apr 2009 02:30:10 +0000 (UTC) Cc: slib-discuss-mXXj517/zsQ@public.gmane.org, guile-devel-mXXj517/zsQ@public.gmane.org To: Dan Gildea Original-X-From: slib-discuss-bounces+glssd-slib-discuss=m.gmane.org-mXXj517/zsQ@public.gmane.org Fri Apr 17 04:31:29 2009 Return-path: Envelope-to: glssd-slib-discuss@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LudrS-0003BS-Jr for glssd-slib-discuss@m.gmane.org; Fri, 17 Apr 2009 04:31:27 +0200 Original-Received: from localhost ([127.0.0.1]:44369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ludq3-0000gl-R3 for glssd-slib-discuss@m.gmane.org; Thu, 16 Apr 2009 22:29:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ludpp-0000Zn-WA for slib-discuss-mXXj517/zsQ@public.gmane.org; Thu, 16 Apr 2009 22:29:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ludpl-0000WK-8K for slib-discuss-mXXj517/zsQ@public.gmane.org; Thu, 16 Apr 2009 22:29:45 -0400 Original-Received: from [199.232.76.173] (port=53968 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ludpf-0000Sn-UO; Thu, 16 Apr 2009 22:29:35 -0400 Original-Received: from vms173005pub.verizon.net ([206.46.173.5]:63054) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ludpf-0002Q3-DT; Thu, 16 Apr 2009 22:29:35 -0400 Original-Received: from voluntocracy.org ([71.174.65.100]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPA id <0KI80014Q48V3AKS-q7IJPNDOu5k+2AnmrIGM23L67TkHkek2@public.gmane.org>; Thu, 16 Apr 2009 21:29:24 -0500 (CDT) Original-Received: by voluntocracy.org (Postfix, from userid 500) id D9C4651D7E7; Thu, 16 Apr 2009 22:29:18 -0400 (EDT) In-reply-to: <20090416224432.GA9551-U9BOa8JvqEg/A7J+Bw32uJkQkdDMV+C2@public.gmane.org> (message from Dan Gildea on Thu, 16 Apr 2009 18:44:32 -0400) X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (1203?) X-BeenThere: slib-discuss-mXXj517/zsQ@public.gmane.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: The SLIB Scheme library List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: slib-discuss-bounces+glssd-slib-discuss=m.gmane.org-mXXj517/zsQ@public.gmane.org Errors-To: slib-discuss-bounces+glssd-slib-discuss=m.gmane.org-mXXj517/zsQ@public.gmane.org Xref: news.gmane.org gmane.lisp.scheme.slib.discuss:37 gmane.lisp.guile.devel:8419 Archived-At: | Date: Thu, 16 Apr 2009 18:44:32 -0400 | From: Dan Gildea | | On Thu, April 16, 2009 at 12:07PM, Aubrey Jaffer wrote: | > | Date: Wed, 15 Apr 2009 20:33:53 -0400 | > | From: Dan Gildea | > | | > | 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 #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 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 #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 #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 -------