unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* repl, abridged output?
@ 2012-12-03 12:39 Daniel Llorens
  2012-12-04  1:43 ` Daniel Hartwig
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Llorens @ 2012-12-03 12:39 UTC (permalink / raw)
  To: guile-user

	
Hello,

When I work with large arrays or other large data structures on the command line, I have to be careful not to print them. Guile always prints these things in full, it takes forever and often I can't even C-c.

I've seen that there's a REPL command ,inspect that produces abridged output. Is it possible to have this as the default for printing to the REPL? Is there any way to configure this?

Thanks,

	Daniel




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

* Re: repl, abridged output?
  2012-12-03 12:39 repl, abridged output? Daniel Llorens
@ 2012-12-04  1:43 ` Daniel Hartwig
  2012-12-04  9:28   ` Daniel Llorens
  2012-12-04 12:59   ` Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Hartwig @ 2012-12-04  1:43 UTC (permalink / raw)
  To: Daniel Llorens; +Cc: guile-user

On 3 December 2012 20:39, Daniel Llorens <dll@bluewin.ch> wrote:
> I've seen that there's a REPL command ,inspect that produces
> abridged output. Is it possible to have this as the default for
> printing to the REPL? Is there any way to configure this?

scheme@(guile-user)> (eval '(set! repl-print
                              (lambda (repl val)
                                (if (not (eq? val *unspecified*))
                                    (begin
                                      (run-hook before-print-hook val)
                                      (format #t "~20@y" val)
                                      (newline)))))
                           (resolve-module '(system repl common)))
scheme@(guile-user)> (use-modules (srfi srfi-1))
scheme@(guile-user)> (iota 500)
$1 = (0 1 2 3 4 5 6 7 …)



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

* Re: repl, abridged output?
  2012-12-04  1:43 ` Daniel Hartwig
@ 2012-12-04  9:28   ` Daniel Llorens
  2012-12-04 12:59   ` Ludovic Courtès
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Llorens @ 2012-12-04  9:28 UTC (permalink / raw)
  To: Daniel Hartwig; +Cc: guile-user


On Dec 4, 2012, at 02:43, Daniel Hartwig wrote:

> On 3 December 2012 20:39, Daniel Llorens <dll@bluewin.ch> wrote:
>> I've seen that there's a REPL command ,inspect that produces
>> abridged output. Is it possible to have this as the default for
>> printing to the REPL? Is there any way to configure this?
> 
> scheme@(guile-user)> (eval '(set! repl-print
>                              (lambda (repl val)
>                                (if (not (eq? val *unspecified*))
>                                    (begin
>                                      (run-hook before-print-hook val)
>                                      (format #t "~20ATy" val)
>                                      (newline)))))
>                           (resolve-module '(system repl common)))
> scheme@(guile-user)> (use-modules (srfi srfi-1))
> scheme@(guile-user)> (iota 500)
> $1 = (0 1 2 3 4 5 6 7 …)

Excellent, thank you.

For the benefit of the list, AT in the format string is the at character.

	Daniel





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

* Re: repl, abridged output?
  2012-12-04  1:43 ` Daniel Hartwig
  2012-12-04  9:28   ` Daniel Llorens
@ 2012-12-04 12:59   ` Ludovic Courtès
  2012-12-05  7:00     ` Nala Ginrut
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2012-12-04 12:59 UTC (permalink / raw)
  To: guile-user

Hi!

Daniel Hartwig <mandyke@gmail.com> skribis:

> On 3 December 2012 20:39, Daniel Llorens <dll@bluewin.ch> wrote:
>> I've seen that there's a REPL command ,inspect that produces
>> abridged output. Is it possible to have this as the default for
>> printing to the REPL? Is there any way to configure this?
>
> scheme@(guile-user)> (eval '(set! repl-print
>                               (lambda (repl val)
>                                 (if (not (eq? val *unspecified*))
>                                     (begin
>                                       (run-hook before-print-hook val)
>                                       (format #t "~20@y" val)
>                                       (newline)))))
>                            (resolve-module '(system repl common)))
> scheme@(guile-user)> (use-modules (srfi srfi-1))
> scheme@(guile-user)> (iota 500)
> $1 = (0 1 2 3 4 5 6 7 …)

Indeed.  Perhaps there should be a standard, simple way to do that.
Would you like to propose a patch?  :-)

Ludo’.




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

* Re: repl, abridged output?
  2012-12-04 12:59   ` Ludovic Courtès
@ 2012-12-05  7:00     ` Nala Ginrut
  0 siblings, 0 replies; 5+ messages in thread
From: Nala Ginrut @ 2012-12-05  7:00 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-user

On Tue, 2012-12-04 at 13:59 +0100, Ludovic Courtès wrote:
> Hi!
> 
> Daniel Hartwig <mandyke@gmail.com> skribis:
> 
> > On 3 December 2012 20:39, Daniel Llorens <dll@bluewin.ch> wrote:
> >> I've seen that there's a REPL command ,inspect that produces
> >> abridged output. Is it possible to have this as the default for
> >> printing to the REPL? Is there any way to configure this?
> >
> > scheme@(guile-user)> (eval '(set! repl-print
> >                               (lambda (repl val)
> >                                 (if (not (eq? val *unspecified*))
> >                                     (begin
> >                                       (run-hook before-print-hook val)
> >                                       (format #t "~20@y" val)
> >                                       (newline)))))
> >                            (resolve-module '(system repl common)))
> > scheme@(guile-user)> (use-modules (srfi srfi-1))
> > scheme@(guile-user)> (iota 500)
> > $1 = (0 1 2 3 4 5 6 7 …)
> 
> Indeed.  Perhaps there should be a standard, simple way to do that.
> Would you like to propose a patch?  :-)
> 

Daniel has posted a patch for that, and it simplified my color-REPL
work. My patch will be based on his patch, then I don't have to patch
'pp' now.

Coming soon.

> Ludo’.
> 
> 





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

end of thread, other threads:[~2012-12-05  7:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-03 12:39 repl, abridged output? Daniel Llorens
2012-12-04  1:43 ` Daniel Hartwig
2012-12-04  9:28   ` Daniel Llorens
2012-12-04 12:59   ` Ludovic Courtès
2012-12-05  7:00     ` Nala Ginrut

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).