[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 09/09: Explicit #:dims? option for array-print, array-pr
From: |
Daniel Llorens |
Subject: |
[Guile-commits] 09/09: Explicit #:dims? option for array-print, array-print-prefix |
Date: |
Fri, 17 Feb 2017 10:34:13 -0500 (EST) |
lloda pushed a commit to branch wip-exception-truncate
in repository guile.
commit 7cf89a3460d0dfeb6e179ff2189cc3d8ed1e4239
Author: Daniel Llorens <address@hidden>
Date: Thu Feb 16 18:40:36 2017 +0100
Explicit #:dims? option for array-print, array-print-prefix
An array with all the dimensions printed out is still readable syntax
and may be read faster.
* module/ice-9/arrays.scm (array-print-prefix, array-print): As stated.
---
module/ice-9/arrays.scm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/module/ice-9/arrays.scm b/module/ice-9/arrays.scm
index 4850522..450dd3f 100644
--- a/module/ice-9/arrays.scm
+++ b/module/ice-9/arrays.scm
@@ -39,14 +39,14 @@
;; Printing arrays
;; FIXME replace scm_i_print_array() when performance allows.
-(define (array-print-prefix a port)
+(define* (array-print-prefix a port #:key dims?)
(put-char port #\#)
(display (array-rank a) port)
(let ((t (array-type a)))
(unless (eq? #t t)
(display t port)))
(let ((ss (array-shape a)))
- (let loop ((s ss) (slos? #f) (szero? #f) (slens? #f))
+ (let loop ((s ss) (slos? #f) (szero? #f) (slens? dims?))
(define lo caar)
(define hi cadar)
(if (null? s)
@@ -65,11 +65,11 @@
(or szero? zero-size?)
(or slens? (and (not zero-size?) szero?))))))))
-(define (array-print a port)
+(define* (array-print a port #:key dims?)
(define (array-rest a s)
(apply make-shared-array a (lambda i i)
(cons (list (+ 1 (caar s)) (cadar s)) (cdr s))))
- (array-print-prefix a port)
+ (array-print-prefix a port #:dims? dims?)
(let ((ss (array-shape a)))
(cond
((zero? (array-rank a))
- [Guile-commits] branch wip-exception-truncate updated (b0d9386 -> 7cf89a3), Daniel Llorens, 2017/02/17
- [Guile-commits] 01/09: Remove unnecessary #include, Daniel Llorens, 2017/02/17
- [Guile-commits] 05/09: Support non-zero lower bounds in array-slice-for-each, Daniel Llorens, 2017/02/17
- [Guile-commits] 07/09: Remove scm_generalized_vector_get_handle, Daniel Llorens, 2017/02/17
- [Guile-commits] 02/09: Replace uniform-vector-read benchmark with bytevector-io benchmark, Daniel Llorens, 2017/02/17
- [Guile-commits] 03/09: Remove documentation on uniform-vector-read!, uniform-vector-write, Daniel Llorens, 2017/02/17
- [Guile-commits] 09/09: Explicit #:dims? option for array-print, array-print-prefix,
Daniel Llorens <=
- [Guile-commits] 08/09: (wip) give a handle into format used in exceptions, Daniel Llorens, 2017/02/17
- [Guile-commits] 06/09: Fix bitvectors and non-zero lower bound arrays in truncated-print, Daniel Llorens, 2017/02/17
- [Guile-commits] 04/09: Fix sort, sort! for arrays with nonzero lower bound, Daniel Llorens, 2017/02/17