From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Daniel Llorens Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Re: GNU Guile 2.1.7 released (beta) Date: Tue, 28 Feb 2017 02:49:51 +0100 Message-ID: References: <87y3x3zt6v.fsf@pobox.com> <87tw7kviu6.fsf@pobox.com> <20170227210444.681b8e02@capac> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1488246611 11280 195.159.176.226 (28 Feb 2017 01:50:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 28 Feb 2017 01:50:11 +0000 (UTC) Cc: Andy Wingo , guile-user@gnu.org, guile-devel@gnu.org To: David Pirotte Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Feb 28 02:50:04 2017 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciWvU-0002Iy-Bj for guile-devel@m.gmane.org; Tue, 28 Feb 2017 02:50:04 +0100 Original-Received: from localhost ([::1]:58070 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciWva-0006s2-6A for guile-devel@m.gmane.org; Mon, 27 Feb 2017 20:50:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciWvR-0006rh-SB for guile-devel@gnu.org; Mon, 27 Feb 2017 20:50:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciWvM-0004Db-Uk for guile-devel@gnu.org; Mon, 27 Feb 2017 20:50:01 -0500 Original-Received: from vimdzmsp-sfwd02.bluewin.ch ([195.186.227.131]:47240 helo=smtpauths.lb.bluewin.ch) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciWvM-0004CQ-JZ; Mon, 27 Feb 2017 20:49:56 -0500 Original-Received: from 4box.home ([83.77.215.134]) by vimdzmsp-sfwd02.bluewin.ch Swisscom AG with SMTP id iWvHcU0i6cMwOiWvIcBZIx; Tue, 28 Feb 2017 02:49:52 +0100 X-Bluewin-Spam-Analysis: v=2.1 cv=C6xJsV7+ c=1 sm=1 tr=0 a=CUsVkSzPQPVOivXIjOOFQA==:117 a=CUsVkSzPQPVOivXIjOOFQA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=N659UExz7-8A:10 a=mDV3o1hIAAAA:8 a=9_z4XU4PdRfgJEEBPNkA:9 a=pILNOxqGKmIA:10 a=APJ1eWDiqboA:10 a=x03gq1O_-gQA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-Bluewin-Spam-Score: 0.00 X-FXIT-IP: IPv4[83.77.215.134] Epoch[1488246592] X-Bluewin-AuthAs: dll@bluewin.ch In-Reply-To: <20170227210444.681b8e02@capac> X-Mailer: Apple Mail (2.1878.6) X-CMAE-Envelope: MS4wfIuwud2TEJCyfJCdXVrRh5Qb7nWk+Gp9edzt0wfShGLPS7aqLSAUgFrB7nXztGrcaRisYoKXb5E9D9IN10knhMZ27wNGryVJ0PD0ImllASE8IatZkIGp sfEMdmRuehhkhNu6J4utBW3TRSDlrEoLWlAG+FUpVpJlWS8rfZ3edL/a+nsLdIbf0fyzJqpLUYxY09B33yBslkQwmMPOWAZRtrcy8jVlqV960fHjqzbCEqMs 8S1pXi5HXk9nAimXSp2gVQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 195.186.227.131 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:18961 gmane.lisp.guile.user:13351 Archived-At: On 28 Feb 2017, at 01:04, David Pirotte wrote: > Hi Andy, >=20 >> So! Release blockers. >> ... >=20 > Not a blocker, at all, but I was thinking to this, wrt manipulating = (very) large > vectors, arrays, lists ... >=20 > -] repl - truncated-print >=20 > Right now I edit the installed (system repl common), and wrote a tip = in Guile-CV's > manual so users can do that as well: less then optimal :). It would = be nice to > provide an option, so users could set it 'just like that', in the = repl, or as a > global config in their .guile (I did see lloda does that in his for = arrays, but it's > not an obvious option to set, it is a 'sophisticated' little piece of = code (for an > end-user at least)). I think this is the minimum for .guile: (import (system repl common) (ice-9 format)) (repl-default-option-set! 'print (lambda (repl val) (format #t "~200@y" = val))) That doesn't seem so bad. For the current repl you can do: (repl-option-set! (car (fluid-ref *repl-stack*)) 'print (lambda (repl = val) (format #t "~200@y" val))) We could have shortcuts, something like: ; not in current Guile (repl-default-print-truncate! 200) (repl-print-truncate! (current-repl) 200) What do you think? I'm guilty of finding these things by googling mailing lists and = browsing the Guile source... repl-default-option-set! is documented, but = repl-option-set!/ref isn't. There seems to be a chunk of text missing = here: https://www.gnu.org/software/guile/manual/html_node/System-Commands.html There's one thing that I realized recently, that something like #1:5(a b = c d e) or #@0:5(a b c d e) is actually valid read syntax, although #:5(a = b c d e) is invalid, not sure if it should be. (Of course the = truncated-print output doesn't *have* to be readable.) So it may be a = good idea to print truncated arrays/vectors/etc that way, maybe even by = default. > -] error(s) while manipulating (very) large vectors or arrays >=20 > Unlike the above, it appears there is currently no way to have error = (the procedure) > and raised exceptions in general, to use truncated-print, it would be = cool to 'link' > the above option so error reports use it as well. Agreed, this is a serious issue for me. Unfortunately the current API = lets the error reporter decide how to print the arguments using a format = string (cf scm_error) so you have to work around that. The hack I posted recently to guile-devel was buggy, so I'll repeat it = here without the bug. It needs this patch: = http://git.savannah.gnu.org/gitweb/?p=3Dguile.git;a=3Dcommitdiff;h=3D6118d= 9dd0cc7733ca71c6b803a942a15f463663a and this code in .guile: ; Truncate output on exceptions. Requires exception-format to be used in = ice-9/boot.scm. ; FIXME doesn't handle e.g. "x~~~s" -> "x~~~@y" (define (rewrite-fmt fmt) (let loop ((f "") (b 0)) (let ((next (string-contains-ci fmt "~s" b))) (if next (loop (if (or (zero? next) (not (char=3D? #\~ (string-ref fmt (- next = 1))))) (string-append f (substring fmt b next) "~200@y") f) (+ next 2)) (string-append f (substring fmt b)))))) (define (truncate-format port fmt . args) (apply format port (rewrite-fmt fmt) args)) (set! exception-format truncate-format) This can't work in general, since the call to scm_error may decide to = use ~a instead of ~s, etc. I'd limit further what can go into that = format string. But I would welcome a proper solution. Regards =97lloda